VBA to choose printer

Queenofmycastle

Board Regular
Joined
Oct 27, 2009
Messages
62
Office Version
  1. 2016
Platform
  1. Windows
This is one of my most used VBA formulas. I want to share my file with other offices. Is there a way to have it so that the printer can be changed without knowing VBA?

Thanks so much!

Sub PrintEntireSetJ6()
Dim i As Integer


Application.ActivePrinter = "iR-ADV C350 PCL 5c on Ne06:"
[J6].FormulaR1C1 = "1"
ExecuteExcel4Macro _
"PRINT(1,,,1,,,,,,,,2,""iR-ADV C350 on Ne03:"",,TRUE,,FALSE)"


For i = 2 To 25
[J6].FormulaR1C1 = CStr(i)
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
Next i
[J6].FormulaR1C1 = "1"
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
.
Code:
Option Explicit


Sub iActiveSheet_Print()
' First choose a printer
    Application.Dialogs(xlDialogPrinterSetup).Show
End Sub
 
Upvote 0
Considering I'm not well versed in this, I added this to this macro and it didn't work. Do I put it in another place? So sorry!
 
Upvote 0
.
Paste it as a separate macro with a command button to initiate it.

You can also include it within another macro ... just this line : Application.Dialogs(xlDialogPrinterSetup).Show
Of course you'll want to place it before the actual command/s for printing.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top