AW: Kein "ExportAsFixedFormat" unter Excel 2003
12.07.2014 11:24:19
Laser
Hallo Martin
Sorry für die späte Antwort hatte ein bisschen Stress in der Firma.
Also ich hab den Code mal auf ein Commandbutton gelegt aber er bringt mir ne Fehlermeldung.
"Fehler beim Kompilieren: sub oder Function nicht definiert
Private Sub CommandButton4_Click()
'Sub PrintToPDF_Early(Blattname)
'Author : Ken Puls (www.excelguru.ca)
'Macro Purpose: Print to PDF file using PDFCreator
' (Download from http://sourceforge.net/ _
projects/pdfcreator/)
' Designed for early bind, set reference to PDFCreator
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
Dim DefaultPrinter
'/// Change the output file name here! ///
sPDFName = "Test.pdf"
'sPDFPath = ActiveWorkbook.Path & Application.PathSeparator
sPDFPath = "C:\Users\Administrator\Dropbox\Firmen Sync-Server\Nachkalkulation, Berichte" '" _
C:\Temp\Repatest"
'Check if worksheet is empty and exit if so
If IsEmpty(Worksheets("Rechnungsbericht").UsedRange) Then Exit Sub
Set pdfjob = New PDFCreator.clsPDFCreator
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
.cPrinterStop = False '
End With
'Print the document to PDF
Worksheets("Rechnungsbericht").PrintOut copies:=1, ActivePrinter:="PDFCreator"
Break
'Wait until the print job has entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Sleep 250
Loop
MsgBox "PDF Dokument wurde erzeugt"
pdfjob.cClose
Set pdfjob = Nothing
End Sub
keine Ahnung was das sein könnte