AW: PDF erstellen und gleich drucken
21.07.2022 11:44:54
Nepumuk
Hallo Pepi,
teste mal:
Option Explicit
Private Declare PtrSafe Function ShellExecuteA Lib "shell32.dll" ( _
ByVal hwnd As LongPtr, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As LongPtr
Private Const SW_HIDE As Long = 0
Public Sub Test2()
Dim strOldPrinter As String, strNewPrinter As String
strOldPrinter = Application.ActivePrinter
If Application.Dialogs(xlDialogPrinterSetup).Show Then
strNewPrinter = Chr$(34) & Left$(Application.ActivePrinter, InStr(1, Application.ActivePrinter, "Auf", vbTextCompare) - 2) & Chr$(34)
Call ShellExecuteA(0, "PRINTTO", "G:\Eigene Dateien\Eigene PDF\ASCII-Tabelle.pdf", strNewPrinter, vbNullString, SW_HIDE)
Application.ActivePrinter = strOldPrinter
End If
End Sub
ich versteh allerdings nicht, warum du nicht einfach das Word-Dokument druckst.
Gruß
Nepumuk