I would like to know if this is possible.
I have a pdf form that I would like to populate if I enter info in one field. For example. If I enter the PO number, I would like for the rest of the eight fields to populate. I finally was able to get the form to pull up and populate but it only populates based on the row number. I dont need it to save or print because I have other things to do with the form before that. Any help would be appreciated! thank you!
here is what I have so far:
I have a pdf form that I would like to populate if I enter info in one field. For example. If I enter the PO number, I would like for the rest of the eight fields to populate. I finally was able to get the form to pull up and populate but it only populates based on the row number. I dont need it to save or print because I have other things to do with the form before that. Any help would be appreciated! thank you!
here is what I have so far:
VBA Code:
Sub PDFTemplate()
Dim PDFFldr As FileDialog
Set PDFFldr = Application.FileDialog(msoFileDialogFilePicker)
With PDFFldr
.Title = "Select PDF file to attach"
.Filters.Add "PDF Type Files", "*.pdf", 1
If .Show <> -1 Then GoTo NoSelection
Sheet1.Range("N10").Value = .SelectedItems(1)
End With
NoSelection:
End Sub
Sub CreatePDFForms()
Dim PDFTemplateFile, NewPDFName, SavePDFFolder, PO As String
Dim Vendor As Name
Dim PORow, LastRow As Long
With Sheet1
LastRow = .Range("A9999").End(xlUp).Row 'Last Row
PDFTemplateFile = .Range("N10").Value 'Template File Name
ActiveWorkbook.FollowHyperlink "f:\APV.pdf"
Application.Wait Now + 0.00006
For PORow = 2 To 2 'LastRow
PO = .Range("A" & PORow).Value 'PO
Application.SendKeys "{Tab}", True
Application.SendKeys PO
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("B" & PORow).Value, True 'Vendor
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("E" & PORow).Value, True 'FM
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("C" & PORow).Value, True 'ID
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("I" & PORow).Value, True 'Account
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("D" & PORow).Value, True 'Organization
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("F" & PORow).Value, True 'FUNd
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("G" & PORow).Value, True 'ORG
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("H" & PORow).Value, True 'PROG
Application.Wait Now + 0.00001
Next PORow
End With
End Sub
Last edited by a moderator: