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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
.
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,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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