Hi,
I'm using following code to print my sheet to PDF, this code is working in excel 2007, but unfortunately when I run it in 2003 it won't work. I do not get any error message in VBA, after executing scrip I see print pop up window as usually, but after that nothing happens.
I think that the problem is in PDF Creator but I don't know how to fix this.
I would appreciate if someone can help me to solve this one.
Thanks in advance
M
Option Explicit
Sub PRINTASPDF()
Calculate
Dim PrintPDF As PDFCreator.clsPDFCreator
Dim FName As String
Dim FilePath As String
Dim SaveStr As String
FName = ActiveWorkbook.Worksheets("PONUDA").Range("f10") & ".pdf"
SaveStr = "C:\Ponude\"
Set PrintPDF = New PDFCreator.clsPDFCreator
With PrintPDF
PrintPDF.cPrinterStop = True
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = SaveStr
.cOption("AutosaveFilename") = FName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
Do Until PrintPDF.cCountOfPrintjobs = 1
DoEvents
Loop
PrintPDF.cPrinterStop = False
Do Until PrintPDF.cCountOfPrintjobs = 0
DoEvents
Loop
PrintPDF.cClose
Set PrintPDF = Nothing
Exit Sub
End Sub
Bookmarks