I'm using the pdf file to convert to excel, but with the current file I'm unable to convert as the result is in
Not exactly as per the pdf, if I print it again as pdf and I'm getting the result as per the pdf.
%PDF-1.4 %âãÏÓ 3 0 obj [/PDF/Text/ImageB/ImageC/ImageI] endobj 5 0 obj [611 556 278 556 333 278 722 556 222 222 500 278 611 667 500 333 667 722 667 667 722 778 722 333 722 556 333 278 556 556 556 833 667 667 667 278 667 778 722 556 556 556 278 556 556 556 556 556 556 556 833 556 556 778 278 667 556 722 778 667 278 556 500 500 278 722 556] endobj 7 0 obj [-665 -325 2000 1040] endobj 8 0 obj <>stream xœ¤} |TÅýø̼s÷íñöÈÞÙ}É&›% |
Code used to convert pdf to excel
Public Sub test()
Dim InitialFolder As String, FullName As Variant, ShtPdfData As Worksheet
Dim wdApp As Object, wdPdfDoc As Object, wdRange As Object
InitialFolder = Environ("userprofile") & "\Desktop\test\"
ChDrive Left(InitialFolder, 1)
ChDir InitialFolder
FullName = Application.GetOpenFilename("PDF Files (*.pdf), *.pdf", 1)
If Not VarType(FullName) = vbBoolean Then
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set wdPdfDoc = wdApp.Documents.Open(filename:=FullName, ConfirmConversions:=False, ReadOnly:=False, Format:=0, NoEncodingDialog:=True)
Set wdRange = wdPdfDoc.Range(1)
wdRange.WholeStory
wdRange.Copy
Set ShtPdfData = ThisWorkbook.Worksheets.Add
ShtPdfData.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
Application.Goto ShtPdfData.Range("A1")
wdPdfDoc.Close False
wdApp.DisplayAlerts = False
wdApp.Quit
Else
'cancel was pressed
End If
End Sub