Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1180to1184
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

PDF speichern

PDF speichern
Leitz
Hallo!
Habe folgenden Code, der aber nicht funktioniert. Warum? bitte um Hilfe!
Sub PrintToPDF_Early()
'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
'/// Change the output file name here! ///
sPDFName = "testPDF.pdf"
sPDFPath = ActiveWorkbook.Path & Application.PathSeparator
'Check if worksheet is empty and exit if so
If IsEmpty(ActiveSheet.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
End With
'Print the document to PDF
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
'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
Loop
pdfjob.cClose
Set pdfjob = Nothing
End Sub

Gruß
Leitz G.

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: PDF speichern
11.10.2010 17:18:49
mumpel
Hallo!
1. Bekommst Du eine Fehlermeldung?
2. Hast Du den PDF-Creator installiert?
3. Hast Du die Steuerdatei für den PDF-Creator über "Extras->Verweise" eingebunden?
Das Makro funktioniert nur mit dem PDF-Creator in Verbindung mit "Early-Binding (siehe Frage 2).
Gruß, René
AW: PDF speichern
12.10.2010 09:44:12
Leitz
Hallo!
Dankeschön für die Hilfe!
Punkt 3 hab ich sicher nicht erledigt, nur ich verstehe nicht was ich da machen soll!
Gruß
Leitz G.
AW: PDF speichern
12.10.2010 14:03:25
Sobotta
Hallo,
Du sollst im VBA Editor unter "Extras" , "Verweis" nach PDFCreator suchen und diesen anhaken.
(da Du eine Objekt von diesem erstellst!
Gruß
Mark
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige