VBA error in copying .pdf to .xlsm

Cross Terrier

New Member
Joined
May 3, 2016
Messages
48
I have the following code, and it is fine until I get to the very last line - the important part, pasting the data:

PHP:
Sub Copy()

Dim CopyApp As String
Dim PDFFile As String
Dim StartCopy

CopyApp = "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
PDFFile = "\\host\users\me\test data.pdf"

StartCopy = Shell("" & CopyApp & " " & PDFFile & "",1)

SendKeys ("^a")
SendKeys ("^c")

Workbooks("pdf to excel").Activate

Range("A1").Activate
ActiveSheet.PasteSpecial Format:="Text"

End Sub

Yes, I'm using the horrible SendKeys but that's actually working and the issue is with pasting the converted data into a blank sheet.

I may come back with questions about extending this code to sort Text to Columns in a while, but I shall have a go myself first, once this problem is out of the way. Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
has it ever worked, my knowledge of PDF is basically a OCR image and not primarily text
 
Upvote 0

Forum statistics

Threads
1,224,271
Messages
6,177,617
Members
452,786
Latest member
k3calloway

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top