Quote:
Originally Posted by charlesdh
Hi,
If you can not edit the PDF file then I do not think you will be able to do as you want.
|
HI charlesdh,
Many thanks after a long time i got the reply. yes its difficult convert from PDF to Excel but here i tried with some vba code to transfer from PDF to excel.
First will convert to word and then it will copy to excel sheet the code was working fine in Word file but after import to excel file the column display is not showing correct. at least i dont want all the data to copy in excel i need only specific column to data to transfer in excel if possible have a look to solve this problems please..
Code:
Sub read_pdf_document_tables()
Const PDFPath As String = "C:\Users\u\Downloads\maximoreport\ORIGINAL FILE.pdf"
Dim sht As Worksheet
Dim WDoc As Word.Document
Dim WApp As Word.Application
Dim i As Long, r As Long, c As Long
Dim rng As Range, t As Word.Table
Set WApp = CreateObject("Word.Application")
WApp.Visible = True
Set WDoc = WApp.Documents.Open(PDFPath, ConfirmConversions:=False, ReadOnly:=False)
Set sht = Sheets("Temp")
Set rng = sht.Range("A1")
sht.Activate
For Each t In WDoc.Tables
t.Range.Copy
rng.Select
rng.Parent.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:=False
With rng.Resize(t.Rows.Count, t.Columns.Count)
.Orientation = xlLandscape
.Cells.UnMerge
Cells.Columns.AutoFit
Cells.Rows.AutoFit
End With
Set rng = rng.Offset(t.Rows.Count + 2, 0)
Next t
WDoc.Close 'word file will close
WApp.Quit ' word file will close
End Sub