I am using VBA as a platform to do some PDF manipulation. The issue I am having is that I cannot seem to get the PDF object to save if the PDF object have not been opened. Below is a snippet of the code that inserts pages to the PDF object, and then saves the pdf object. In terms of the code, I have determined that it works since I have tested the save method with the same input with another pdf object and it worked just fine. Can someone help by explaining why it doesn't allow me to save the object?
Thanks!
Dim NewPDF As New Acrobat.AcroPDDoc
Set NewPDF = CreateObject("AcroExch.PDDoc")
If NewPDF.InsertPages(j, OriPDF, j, 1, 0) Then MsgBox "Success"
If NewPDF.Save(PDSaveLinearized, WritePath & "\" & sh.Cells(StartRow + j - 1, i).Value & ".pdf") Then MsgBox "Success"
NewPDF.Close
Set NewPDF = Nothing
When the above code was ran, neither of the success lines worked as expected.