Drucken von Dateien, ohne sie zu öffnen. Benötigt wird eine Form und ein
Commandbutton.
Private Declare Function ShellExecuteAny Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As Any, _
ByVal lpDirectory As Any, _
ByVal nShowCmd As Long) _
As Long
Const SW_SHOWMINNOACTIVE = 7
Private Function PrintFile(sFilePath As String)
Call ShellExecuteAny(Me.hwnd, "print", sFilePath, _
ByVal 0&, ByVal 0&, SW_SHOWMINNOACTIVE)
End Function
Private Sub Command1_Click()
' Datei drucken ohne sie zu öffnen
Call PrintFile("D:\test.txt")
End Sub