Hi,
I've added a reference to Acrobat in the project and written the following code...
But I get an error "activex component can't create object".
I've done G! and have found lots about creating a PDF, which I can do with the PDFCreator plugin no problem.
I have also found some stuff for doing it with VB6, but I can't seem to find anything specifically for VBA.
Can someone please help me print a PDF from VBA.
thanks,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts
I've added a reference to Acrobat in the project and written the following code...
Code:
Sub PrintPDF(ByVal sFile As String)
Dim PDFApp As Object
On Error GoTo EH_PrintPDF
'create instance of PDF
Set PDFApp = CreateObject("Acrobat.Application")
'Open document
PDFApp.Documents.Open sFile
'print
PDFApp.ActiveDocument.PrintOut False, , wdPrintAllDocument
'close Word without saving
PDFApp.Quit False
'free reference
Set PDFApp = Nothing
sDoUpd = "Yes"
Exit_PrintPDF:
Exit Sub
EH_PrintPDF:
MsgBox "Error in PrintPDF " & Error(Err) & ", " & CStr(Err)
sDoUpd = "No"
Resume Exit_PrintPDF
End Sub
But I get an error "activex component can't create object".
I've done G! and have found lots about creating a PDF, which I can do with the PDFCreator plugin no problem.
I have also found some stuff for doing it with VB6, but I can't seem to find anything specifically for VBA.
Can someone please help me print a PDF from VBA.
thanks,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts