Search

VBA to read values in PDF Form without Reader or Acrobat API - VBA PDF Automation-12

Subscribe Now!
New videos every Weekend!


Like what I do? Donate
Did I help you? Did one of my tutorials save you sometime? 
You can say thank you by buying me a cup of coffee, I go through a lot of it.
Help keep Greater Good resources free for everyone. Please donate today. 




This page is not monitored so for questions please comment on the youtube video page. For suggestions email vbaa2z.team@gmail.com

Download project or source code from below link(s)
PDF files used for demonstration
https://bit.ly/2MDOaKz
https://bit.ly/2YbyIe8
https://bit.ly/2AQp2Ol

Free code download

Option Explicit
Const form_filename As String = "C:\Inventory Form.pdf"
Sub read_pdf_form_vals()
Dim fso As New FileSystemObject
Dim tStream As TextStream
Dim vLine As String, vKey As String, fieldList() As Variant, arrIndx As Integer
Dim lIndx As Integer
vKey = ") Tj"
Set tStream = fso.OpenTextFile(form_filename, ForReading, False)
Do While Not tStream.AtEndOfStream
   vLine = tStream.ReadLine
   
   If InStr(vLine, vKey) > 0 Then
      vLine = Replace(Right(vLine, Len(vLine) - 1), vKey, "", 1)
      ReDim Preserve fieldList(0 To arrIndx)
      fieldList(arrIndx) = vLine
      Debug.Print vLine
      'Stop
      arrIndx = arrIndx + 1
   End If
   
   'Stop
   
Loop
'Stop
Debug.Print "------------"
For lIndx = UBound(fieldList) To LBound(fieldList) Step -1
   Debug.Print fieldList(lIndx)
Next
Set tStream = Nothing
Set fso = Nothing
Stop
End Sub

No comments:

Post a Comment

Note: only a member of this blog may post a comment.