Gerne möchte ich ein einzelnes Tabellenblatt in Excel 2010 als PDF drucken (Achtung: NICHT als PDF speichern, das dann erzeugte PDF kann nicht weiterverarbeitet werden - unabhängig, ob " IncludeDocProperties" auf True oder False steht).
Aufzeichnen über ein Mako hat bei mir leider auch nicht zum Erfolg geführt. Den Drucker (DocuPrinter) bekomme ich angesteuert
" Sheets("PDF").Select
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, _
ActivePrinter:="Docuprinter", Collate:=True"
Jedoch schaffe ich es nicht, diese PDF dann unter dem Pfad "U:\" zu speichern.
Folgendes Makro hat auch nicht weitergeholfen, hier werden alle Tabellenblätter als PDF gedruckt - ich möchte in meinen Beispiel nur das Blatt "Tabelle1" als PDF drucken.
' Makro3 Makro
'
Dim docToConvert: docToConvert = "U:\Name.xlsx"
Dim DPSDK: Set DPSDK = CreateObject("docuPrinter.SDK")
DPSDK.BackupSettings
DPSDK.DocumentOutputFormat = "PDF"
DPSDK.DocumentOutputName = "test"
DPSDK.DocumentOutputFolder = "u:\"
DPSDK.HideSaveAsWindow = True
DPSDK.DefaultAction = 1
DPSDK.ApplySettings
Dim MSExcel: Set MSExcel = CreateObject("Excel.Application")
MSExcel.DisplayAlerts = False
Dim XLDoc: Set XLDoc = MSExcel.Workbooks.Open(docToConvert, 0, True)
XLDoc.Activate
XLDoc.PrintOut , , , False, "docuPrinter"
XLDoc.Saved = True
XLDoc.Close
MSExcel.Quit
Set MSExcel = Nothing
Dim RVal: RVal = DPSDK.Create ' Create output document
DPSDK.RestoreSettings
Set DPSDK = Nothing
If (RVal <> 0) Then
MsgBox "Error while converting the document!!!"
Else
MsgBox "Done converting!!!"
End If
End Sub