Sub OpenPDF()
Set WshShell = CreateObject("WScript.Shell")
ChDir (WshShell.SpecialFolders("MyDocuments"))
PageName = Application.GetOpenFilename("YourPage, *.pdf", , "YourPage")
If PageName = "False" Then
Exit Sub
End If
FileCopy PageName, "C:\pdf2txt\YourPage.pdf"
ChDir ("C:\pdf2txt")
TestValue = Shell("YourPage.bat", 1)
Application.Wait (Now + TimeValue("0:00:05"))
ChDir "C:\pdf2txt"
PageName = "C:\pdf2txt\YourPage.txt"
Call ReadTextFile
End Sub
Sub ReadTextFile()
Dim FileNum As Integer
Dim r As Integer
Dim wb As Workbook
Dim Data As String
r = 1
FileNum = FreeFile
Set wb = Workbooks.Add
Open PageName For Input As #FileNum
Do While Not EOF(FileNum)
Line Input #FileNum, Data
ActiveSheet.Cells(r, 1) = Data
r = r + 1
Loop
Close #FileNum
End Sub
|