Run this macro first to find VBA reference for each printer - this will print values that you need to cells A1 and A2 or (using Debug.Print) to the immediate window in VBA (when in VB window - show Immediate Window with {CTRL} G)
Sub FindActivePrinterNames()
MsgBox "Select BROTHER printer"
Application.Dialogs(xlDialogPrinterSetup).Show
Range("A1").Value = Application.ActivePrinter
Debug.Print Application.ActivePrinter
MsgBox "Select EPSON printer"
Application.Dialogs(xlDialogPrinterSetup).Show
Range("A2").Value = Application.ActivePrinter
Debug.Print Application.ActivePrinter
End Sub
Below is your macro altered to give you a choice of printer.
Simply amend where indicated by pasting in the ActivePrinter values discovered by FindActivePrinterNames.
Private Sub CommandButton1_Click()
'declare variables
Dim Brother As String, Epson As String
'assign values to variables
Epson = "Epson XXXX on YYYY:" 'AMEND THIS VALUE
Brother = "Brother XXXX on ZZZZ:" 'AMEND THIS VALUE
'printer selection
Application.Dialogs(xlDialogPrinterSetup).Show
With ThisWorkbook
Select Case Application.ActivePrinter
Case Brother
'print in original sequence
If Me.Sheet1 = True Then .Sheets("Sheet1").PrintOut Copies:=1
If Me.Sheet2 = True Then .Sheets("Sheet2").PrintOut Copies:=1
If Me.Sheet3 = True Then .Sheets("Sheet3").PrintOut Copies:=1
If Me.Sheet4 = True Then .Sheets("Sheet4").PrintOut Copies:=1
If Me.Sheet5 = True Then .Sheets("Sheet5").PrintOut Copies:=1
If Me.Sheet6 = True Then .Sheets("Sheet6").PrintOut Copies:=1
If Me.Sheet7 = True Then .Sheets("Sheet7").PrintOut Copies:=1
If Me.Sheet8 = True Then .Sheets("Sheet8").PrintOut Copies:=1
If Me.Sheet9 = True Then .Sheets("Sheet9").PrintOut Copies:=1
Case Epson
'print in reverse sequence
If Me.Sheet9 = True Then .Sheets("Sheet9").PrintOut Copies:=1
If Me.Sheet8 = True Then .Sheets("Sheet8").PrintOut Copies:=1
If Me.Sheet7 = True Then .Sheets("Sheet7").PrintOut Copies:=1
If Me.Sheet6 = True Then .Sheets("Sheet6").PrintOut Copies:=1
If Me.Sheet5 = True Then .Sheets("Sheet5").PrintOut Copies:=1
If Me.Sheet4 = True Then .Sheets("Sheet4").PrintOut Copies:=1
If Me.Sheet3 = True Then .Sheets("Sheet3").PrintOut Copies:=1
If Me.Sheet2 = True Then .Sheets("Sheet2").PrintOut Copies:=1
If Me.Sheet1 = True Then .Sheets("Sheet1").PrintOut Copies:=1
Case Else
MsgBox "Invaid selection made"
Exit Sub
End Select
End With
End Sub
Bookmarks