im Prinzip braucht man eigentlich nur das, um ein Att non Platte zu drucken
Sub PrintDefault (fname As String)
'Ref: Microsoft article Q170918
Dim hwnd As Long
Dim ret As Long
Dim msg As String
ret = ShellExecute(hwnd, "Print", fname, "", "", 0)
If ret<32 Then ' Error
Select Case ret
Case ERROR_FILE_NOT_FOUND
msg = "File not found"
Case ERROR_PATH_NOT_FOUND
msg = "Path not found"
Case SE_ERR_ACCESSDENIED
msg = "Access denied"
Case SE_ERR_OOM
msg = "Out of memory"
Case SE_ERR_DLLNOTFOUND
msg = "DLL not found"
Case SE_ERR_SHARE
msg = "A sharing violation occurred"
Case SE_ERR_ASSOCINCOMPLETE
msg = "Incomplete or invalid file association"
Case SE_ERR_DDETIMEOUT
msg = "DDE Time out"
Case SE_ERR_DDEFAIL
msg = "DDE transaction failed"
Case SE_ERR_DDEBUSY
msg = "DDE busy"
Case SE_ERR_NOASSOC
msg = "No association for file extension"
Case ERROR_BAD_FORMAT
msg = "Invalid EXE file or error in EXE image"
Case Else
msg = "Unknown error"
End Select
Msgbox MSG_UnableToPrint + fname + Chr$(13) + MSG_Continue, 16, msg
Print("Could not print attachment: " & fname)
Else
Print("Printing attachment : " & fname)
End If
End Sub