Copy link to clipboard
Copied
I am trying to autofill an existing PDF from excel table. Overall i have figured out the vba design however currently stuck at how to populate date fields where it only accepts data as Y Y Y Y M M D D meaning each digit is individually typed. In excel i have the date as 20201225 however the vba is unable to copy paste that into the date field.
How can i parse the date field in excel to allow the form to be populated?
For example i want date value from Col A to first date field in the form and Value from Col B to Second date field.
The macro is unable to copy paste data for this field:
Application.SendKeys "{Tab}", True
Application.SendKeys datenominee, True
Application.Wait Now + 0.000005
Sub createpdfforms()
Dim pdftemplatefile, newpdfname, savepdffolder, datenominee, dateend As String
Dim custrow, lastrow As Long
With Sheet1
lastrow = .Range("A2000").End(xlUp).Row
pdftemplatefile = .Range("D3").Value
savepdffolder = .Range("D5").Value
Application.Wait Now + 0.00002
For custrow = 8 To 8
datenominee = .Range("A" & custrow).Value
dateend = .Range("B" & custrow).Value
Application.SendKeys "{Tab}", True
Application.SendKeys datenominee, True
Application.Wait Now + 0.000005
Application.SendKeys "{Tab}", True
Application.SendKeys .Range("B" & custrow).Value, True
'so forth and so on for all fields
Next custrow
End With
End Sub
Copy link to clipboard
Copied
You need to split the value into indivdual characters using the SPLIT method, or access them one at a time, using the MID function.