Option Explicit
Sub pdf_To_Excel_Adobe()
Dim myWorksheet As Worksheet
Dim adobeReaderPath As String
Dim pathAndFileName As String
Dim shellPathName As String
Set myWorksheet = ActiveWorkbook.Worksheets("Adobe Reader")
adobeReaderPath = "C:\...\Acrobat Reader DC\Reader\AcroRd32.exe"
pathAndFileName = "C:\...\Power Spreadsheets Examples\Statistical Tables.pdf"
shellPathName = adobeReaderPath & " """ & pathAndFileName & """"
Call Shell( _
pathname:=shellPathName, _
windowstyle:=vbNormalFocus)
Application.Wait Now + TimeValue("0:00:03")
SendKeys "%vpc"
SendKeys "^a"
SendKeys "^c"
Application.Wait Now + TimeValue("0:00:30")
With myWorksheet
.Range("B4").Select
.PasteSpecial Format:="Text"
End With
Call Shell("TaskKill /F /IM AcroRd32.exe", vbHide)
End Sub
Sub pdf_To_Excel_Able2Extract()
Dim myWorksheet As Worksheet
Dim able2ExtractPath As String
Dim pathAndFileName As String
Dim shellPathName As String
Set myWorksheet = ActiveWorkbook.Worksheets("Able2Extract")
able2ExtractPath = "C:\...\Able2Extract 10.0\Able2Extract.exe"
pathAndFileName = "C:\...\Power Spreadsheets Examples\Statistical Tables.pdf"
shellPathName = able2ExtractPath & " """ & pathAndFileName & """"
Call Shell( _
pathname:=shellPathName, _
windowstyle:=vbNormalFocus)
Application.Wait Now + TimeValue("0:00:03")
SendKeys "^a"
SendKeys "^c"
Application.Wait Now + TimeValue("0:00:30")
With myWorksheet
.Range("B4").Select
.PasteSpecial Format:="Text"
End With
Call Shell("TaskKill /F /IM Able2Extract.exe", vbHide)
End Sub
Sub pdf_To_Excel_Word_Late_Binding()
Dim myWorksheet As Worksheet
Dim wordApp As Object
Dim myWshShell As Object
Dim pathAndFileName As String
Dim registryKey As String
Dim wordVersion As String
Set myWorksheet = ActiveWorkbook.Worksheets("Word Late Binding")
Set wordApp = CreateObject("Word.Application")
Set myWshShell = CreateObject("WScript.Shell")
pathAndFileName = "C:\...\Power Spreadsheets Examples\Statistical Tables.pdf"
wordVersion = wordApp.Version
registryKey = "HKCU\SOFTWARE\Microsoft\Office\" & wordVersion & "\Word\Options\"
myWshShell.RegWrite registryKey & "DisableConvertPdfWarning", 1, "REG_DWORD"
wordApp.Documents.Open _
Filename:=pathAndFileName, _
ConfirmConversions:=False
myWshShell.RegWrite registryKey & "DisableConvertPdfWarning", 0, "REG_DWORD"
wordApp.ActiveDocument.Content.Copy
With myWorksheet
.Range("B4").Select
.PasteSpecial Format:="Text"
End With
wordApp.Quit SaveChanges:=0
Set wordApp = Nothing
Set myWshShell = Nothing
End Sub