Here's a snippet of code I am using to convert MS Word docs to PDFs. Similar code works fine in VB6 but in VB.NET is gives me the error "Object reference not set to an instance of an object." The error occurs on this line:
Here is the full snippet:
Code:
AcroDoc.Open("\\path\to\file\test.doc", "")
Here is the full snippet:
Code:
Imports Acrobat
Dim AcroApp As CAcroApp
Dim AcroDoc As CAcroAVDoc
Dim AcroPdf As CAcroPDDoc
AcroDoc.Open("\\path\to\file\test.doc", "")
AcroDoc = AcroApp.GetActiveDoc
AcroPdf = AcroDoc.GetPDDoc
AcroPdf.Save(1 Or 4 Or 32, "\\path\to\file\test.pdf")
AcroPdf.Close()
AcroDoc.Close(True)
AcroApp.Exit()
AcroPdf = Nothing
AcroDoc = Nothing
AcroApp = Nothing