Hello Sir
I have one problem and i am not able to find the solution
In excel vba I am auto converting PDF file to Word using foxit phantom pdf but thing is i want to convert pdf to word from page 2 till the end page
I am not able to get how to find the last page number of pdf and bring the value in vba
below is my code where i have mention call send key ("2-100 ",true) but that is not working because many how many pages will be there in pdf i do not know so can any one help me please
Sub ExtracPDFData()
Dim pdfapp, FileName As Variant
Dim PDFFolder, ExportFile As String
Dim ClientRow, CustCol, DataCol, DataRow, LastRow As Long
pdfapp = Shell("C:Program FilesFoxit SoftwareFoxit PhantomPDFFoxitPhantomPDF.exe", vbNormalFocus)
With Sheet1
If Sheet1.Range("c6").Value = Empty Then
MsgBox "Please Select your PDF File"
Exit Sub
End If
ExportFile = .Range("c6").Value
FileName = ExportFile
PDFFolder = Left$(FileName, InStrRev(FileName, ""))
End With
' CALL PATH NAME FROM SHEET1 C6 CELL
pdfapp = Shell("C:Program FilesFoxit SoftwareFoxit PhantomPDFFoxitPhantomPDF.exe """ & FileName & """", vbNormalFocus)
On Error Resume Next
AppActivate (pdapp)
On Error GoTo 0
Application.Wait Now + 0.0001
Application.SendKeys "%k", True
Application.Wait Now + 0.00001
Application.SendKeys "{home}", True
Application.Wait Now + 0.00001
'Call SendKeys(PDFFolder, True)
Application.SendKeys "%g", True
Application.Wait Now + 0.000001
Application.SendKeys "%p", True
Application.Wait Now + 0.000001
Application.SendKeys "{tab}", True
Application.Wait Now + 0.000001
Call SendKeys("2-100", True)
Application.SendKeys "%p", True
Application.Wait Now + 0.000001
Application.SendKeys "%k", True
Application.Wait Now + 0.000001
Application.SendKeys "%s", True
Application.Wait Now + 0.000001
Application.SendKeys "%y", True
Application.Wait Now + 0.000001
Application.SendKeys "{NUMLOCK}%s"
Application.Wait Now + 0.000001
End Sub
Hi Deepak,
Please review the forum rules and guidelines
https://www.myonlinetraininghub.com/excel-forum/forum-rules-and-guides/read-this-first
When you have a new question please start a new topic, don't post onto the end of an existing thread.
Regards
Phil
Hi Deepak,
I can't really test this without Foxit.
But why not just convert the whole PDF then delete the first page in Word?
See attached. You'll need to set a reference to the Microsoft Word Object Library in Tools -> References in the VBA Editor.
Phil