derricklo1980
IS-IT--Management
Hi,
(1) I tried to use below code to print as PDF from a Word file. I can generate the file, but the file is not a real PDF file (you may refer the attached link file). Any idea?
Sub SetDefaultPrinter()
Dim sCurrentPrinter As String
On Cancel GoTo Cancelled:
' Get the current printer and store the value in sCurrentPrinter
sCurrentPrinter = ActivePrinter
' Set the printer to a PDF converter,
' here I use a freeware CutePDF Writer
ActivePrinter = "CutePDF Writer"
Application.PrintOut OutputFileName:="outputfilename.pdf", _
Item:=wdPrintDocumentContent, PrintToFile:=True
Cancelled:
' Restore the original printer
ActivePrinter = sCurrentPrinter
End Sub
(2) The purpose I don't use Save As as an option to export PDF is that, the Word file is a Mail Merge file which generates several letters, I want to have one combined PDF instead of several PDF files for each record. Any code can achieve this if the above doesn't work?
Thanks!
(1) I tried to use below code to print as PDF from a Word file. I can generate the file, but the file is not a real PDF file (you may refer the attached link file). Any idea?
Sub SetDefaultPrinter()
Dim sCurrentPrinter As String
On Cancel GoTo Cancelled:
' Get the current printer and store the value in sCurrentPrinter
sCurrentPrinter = ActivePrinter
' Set the printer to a PDF converter,
' here I use a freeware CutePDF Writer
ActivePrinter = "CutePDF Writer"
Application.PrintOut OutputFileName:="outputfilename.pdf", _
Item:=wdPrintDocumentContent, PrintToFile:=True
Cancelled:
' Restore the original printer
ActivePrinter = sCurrentPrinter
End Sub
(2) The purpose I don't use Save As as an option to export PDF is that, the Word file is a Mail Merge file which generates several letters, I want to have one combined PDF instead of several PDF files for each record. Any code can achieve this if the above doesn't work?
Thanks!