June 4, 2020
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 Files\Foxit Software\Foxit PhantomPDF\FoxitPhantomPDF.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 Files\Foxit Software\Foxit PhantomPDF\FoxitPhantomPDF.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
October 5, 2010
Hi Deepak,
Please review the forum rules and guidelines
https://www.myonlinetraininghu.....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
1 Guest(s)