Bill, Thank you so much for your help.
I tried to add the missing statements, however I'm getting an error message:
Run-Time error 91':
Object variable or With block variable not set
Error is pointing to the PDFDOC.save statement.
Can you please let me know if you know what is wrong with what I did?
Is it related to missing brackets by any chance
Thanks again.
====================================================================
Sub WriteToAdobeFields()
Dim AcrobatApplication As Acrobat.CAcroApp
Dim AcrobatDocument As Acrobat.CAcroAVDoc
'==============
Dim PdfDoc As Acrobat.CAcroPDDoc
'===============
Dim WasSaved As Variant
Dim Fcount As Long
Dim sFieldName As String
Set AcrobatApplication = CreateObject("AcroExch.App")
Set AcrobatDocument = CreateObject("AcroExch.AVDoc")
'===============
Set PdfDoc = AcrobatDocument.GetPDDoc()
'===============
If AcrobatDocument.Open("C:\Users\ilot\Desktop\VBA Tests\Excel to PDF - Not perfect_Need to fix\1test copy from PDF.pdf", "") Then
AcrobatApplication.Show
Set Acroform = CreateObject("AFormAut.App")
Set Fields = Acroform.Fields
'Set pdfDoc = avdoc.GetPDDoc
Fcount = Fields.Count
Fields("A Identifying number").Value = Sheet1.Range("F5").Value
Fields("City or town state and ZIP code").Value = Sheet1.Range("I5").Value & " " & Sheet1.Range("J5").Value
Fields("Name of person filing this return").Value = Sheet1.Range("E5").Value
PdfDoc.Save PDSaveFull, "C:\Users\ilot\Desktop\VBA Tests\Excel to PDF - Not perfect_Need to fix"
Else
MsgBox "Check"
End If
AcrobatApplication.Exit
Set AcrobatApplication = Nothing
Set Field = Nothing
Set AcrobatDocument = Nothing
Set Acroform = Nothing
Set Fields = Nothing
End Sub