vijehspaul
Member
Hello,
I am trying to import some PDF files to excel using IE (open it in IE and copy-paste to excel ). My code is working for some pdf files. but for some it returns following error : The remote server machine does not exist or is unavailable
Searched many forums to resolve this, but all leads to much complicated solutions which is beyond my coding skills (still am a newbie )...
Please help.
My code:
The pdf files have tables, images and vary in sizes. Working file is small in size.
Please help..
I am trying to import some PDF files to excel using IE (open it in IE and copy-paste to excel ). My code is working for some pdf files. but for some it returns following error : The remote server machine does not exist or is unavailable
Searched many forums to resolve this, but all leads to much complicated solutions which is beyond my coding skills (still am a newbie )...
Please help.
My code:
Code:
Sub ImportPdf()
Dim FileName As String
Dim b2 As Workbook
Dim ie As Object
Dim np As Object
FileName="C:\somepdf.pdf"
Set b2 = ThisWorkbook
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate (FileName)
Application.Wait Now + TimeSerial(0, 0, 8)
Do While ie.ReadyState <> 4 ' 'ERROR comes here.
DoEvents
Loop
AppActivate ie
SendKeys "^(a)", True
Application.Wait Now + TimeSerial(0, 0, 2)
SendKeys "^(c)", True
Application.Wait Now + TimeSerial(0, 0, 2)
b2.Activate
Application.ScreenUpdating = False
With Sheets(2).Activate
Range("A1").Select
ActiveSheet.Paste
End With
Sheets(1).Activate
Application.ScreenUpdating = True
ie.Quit
End Sub
The pdf files have tables, images and vary in sizes. Working file is small in size.
Please help..
Last edited by a moderator: