DarkGlobus1OO
New Member
- Joined
- Sep 28, 2017
- Messages
- 11
i heard it is possible,sadly i didnt manage to achieve this function(the code either gives me an object error or goes to an infinite loop)
anyone done that before and can share his knowledge?
the code i tried:
anyone done that before and can share his knowledge?
the code i tried:
Code:
Sub pdf_To_Excel_early_Binding()
Dim myWorksheet As Worksheet
Dim wordApp As Word.Application
Dim myWshShell As WshShell
Dim pathAndFileName As String
Dim registryKey As String
Dim wordVersion As String
Set myWorsheet = ActiveWorkbook.ActiveSheet
Set wordApp = New Word.Application
Set myWshShell = New WshShell
pathAndFileName = "the address of the pdf file"
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:=wdDoNotSaveChanges
Set wordApp = Nothing
Set myWshShell = Nothing
End Sub
Last edited by a moderator: