How to save acrobat pdf file via AcroExch.PDDoc.Save
Hi,
My macro populates Acrobat PDF file with information stored in an excel spreadsheet.
My issue is to save that pdf after completion of the population.
I get error 91
Object variable or With block variable not set
I am guessing that I do not use properly the statement :Object.save(nType, fullpath)
Thanks in advance for your help.:crying:
Code:
Dim AcrobatApplication 'As Acrobat.CAcroApp
Dim AcrobatDocument 'As Acrobat.CAcroAVDoc
Dim pdfDoc 'As Acrobat.CAcroPDDoc
Dim WasSaved
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("Path\fileName.pdf", "") Then
AcrobatApplication.Show
Set Acroform = CreateObject("AFormAut.App")
Set Fields = Acroform.Fields
Fcount = Fields.Count
Fields("A Identifying number").Value = Sheet1.Range("F5").Value
pdfDoc.Save PDSaveFull, "path"
Else
MsgBox "Check"
End If
AcrobatApplication.CloseAllDocs
AcrobatApplication.Exit
Set AcrobatApplication = Nothing
Set Field = Nothing
Set AcrobatDocument = Nothing
Set Acroform = Nothing
Set Fields = Nothing
Set pdfDoc = Nothing