Option
Explicit
Public
Sub
Test()
Dim
strPrinter
As
String
Dim
strPrinterPrev
As
String
strPrinterPrev = Application.ActivePrinter
Select
Case
MsgBox(Title:=
"Drucken"
, _
Buttons:=vbQuestion + vbYesNoCancel + vbDefaultButton3, _
Prompt:=
"Ihr aktiver Drucker ist:"
& vbNewLine &
" '"
& strPrinterPrev &
"'"
& vbNewLine & vbNewLine & _
"Möchten Sie die Druckaufträge mit diesem Drucker ausführen?"
& vbNewLine & _
"(Nein ... Drucker auswählen)"
)
Case
vbYes
strPrinter = strPrinterPrev
Case
vbNo
If
Application.Dialogs(xlDialogPrinterSetup).Show
Then
strPrinter = Application.ActivePrinter
Else
Exit
Sub
End
If
Case
vbCancel
Exit
Sub
End
Select
With
Worksheets(
"Tabelle1"
)
For
i = 1
To
3
.Range(.Cells(1, i), .Cells(100, i)).PrintOut
Next
End
With
If
strPrinter <> strPrinterPrev
Then
Application.ActivePrinter = strPrinterPrev
End
If
End
Sub