Can I run pdfmaker programatically from within a protected
form?
Recording the menu actions produced this macro line:
Application.Run MacroName:="AdobePDFMakerA.AutoExec.ConvertToPDF"
However, I find that printing to the Distiller Printer is more to my
liking:
Here are some code fragments that might help:
' Requires a Reference to "Acrobat Distiller" (ACRODIST.EXE)
Dim myPDF As New PdfDistiller ' Class PDFDistiller
Dim oldPrinter As String
oldPrinter = ActivePrinter
' Select a printer without changing the system default printer:
With Dialogs(wdDialogFilePrintSetup)
.Printer = "Acrobat Distiller"
.DoNotSetAsSysDefault = True
.Execute
End With
' Next two statements control name of PDF file.
Application.PrintOut OutputFileName:=myPath & myFilename & ".ps", _
PrintToFile:=True, Background:=False
myPDF.FileToPDF myPath & myFilename & ".ps", "", _
theFolder & "\eBook-WebReports.joboptions"
' Select a printer without changing the system default printer:
With Dialogs(wdDialogFilePrintSetup)
.Printer = oldPrinter
.DoNotSetAsSysDefault = True
.Execute
End With
' Restore "PrintToFile" back to false by printing nothing!
' See:
http://www.mvps.org/word/FAQs/MacrosVBA/ResetPrintToFile.htm
Application.PrintOut Range:=wdPrintRangeOfPages, Pages:="0", _
PrintToFile:=False
Set myPDF = Nothing
Good luck.