I use jawspdf creator. The software creates a PDF printer, it is sufficient to determine that it is the default printer. Or I have a code example which works with PDFCreator that you can see below.
Code:
Sub ToPDF ()
Set pdfjob = CreateObject ("PDFCreator.clsPDFCreator")
NomExcel = ThisWorkbook.Name
NomPdf = Left (NomExcel, Len (NomExcel) - 4) & ". Pdf"
With pdfjob
If. Cstart ("/ NoProcessingAtStartup") = False Then
MsgBox "Can not initialize PDFCreator." VbCritical + vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
. COption ("UseAutosave") = 1
. COption ("UseAutisaveDirectory") = 1
. COption ("AutosaveDirectory") = ThisWorkbook.Path
. COption ("AutosaveFilename") = NomPdf
. COption ("AutosaveFormat") = 0
. CClearCache
End With
ThisWorkbook.PrintOut copies: = 1, ActivePrinter: = "PDFCreator"
= 1 Do Until pdfjob.cCountOfPrintjobs
DoEvents
Loop
pdfjob.cPrinterStop = False
= 0 Do Until pdfjob.cCountOfPrintjobs
DoEvents
Loop
With pdfjob
. CDefaultprinter = DefaultPrinter
. CClearCache
. Cclose
End With
= Nothing Set pdfjob
End Sub
Bookmarks