SelectedPrinter name on A1 without changing the ActivePrinter

drom

Well-known Member
Joined
Mar 20, 2005
Messages
528
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance!

In my company I have 5 printers
I know howto select as the ActivePrinter one of them

Code:
Application.Dialogs(xlDialogPrinterSetup).Show

But If I do not want to put as the Activeprinter one of them, I want only put the selected printer within a cell eg: RANGE("A1")

I do not want to use:

Code:
Sub SetPrinter()
Dim wActPrinter As String:        wActPrinter = Application.ActivePrinter
  Dim bPrt As Boolean:            bPrt = Application.Dialogs(xlDialogPrinterSetup).Show
    
    If Not bPrt Then Exit Sub
     
    Range("A1") = ActivePrinter
      'MsgBox ActivePrinter
      
    Application.ActivePrinter = wActPrinter
    
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi and thanks in advance!

In my company I have 5 printers
I know howto select as the ActivePrinter one of them

Code:
Application.Dialogs(xlDialogPrinterSetup).Show

But If I do not want to put as the Activeprinter one of them, I want only put the selected printer within a cell eg: RANGE("A1")

I do not want to use:

Code:
Sub SetPrinter()
Dim wActPrinter As String:        wActPrinter = Application.ActivePrinter
  Dim bPrt As Boolean:            bPrt = Application.Dialogs(xlDialogPrinterSetup).Show
    
    If Not bPrt Then Exit Sub
     
    Range("A1") = ActivePrinter
      'MsgBox ActivePrinter
      
    Application.ActivePrinter = wActPrinter
    
End Sub

I sthis what you want ?
Code:
Sub SetPrinter()Dim wActPrinter As String:        wActPrinter = Application.ActivePrinter
  Dim bPrt As Boolean:            bPrt = Application.Dialogs(xlDialogPrinterSetup).Show
    
    If Not bPrt Then Exit Sub
     
    Range("A1") = Application.ActivePrinter
      'MsgBox ActivePrinter
      
    Application.ActivePrinter = wActPrinter
      
End Sub
 
Upvote 0
Not really!
I do not want to change the activeprinter
I need to get the Selection I get if I use Application.Dialogs(xlDialogPrinterSetup).Show
or If I use any other Dialogs to let me select one printer
 
Upvote 0
Not really!
I do not want to change the activeprinter
I need to get the Selection I get if I use Application.Dialogs(xlDialogPrinterSetup).Show
or If I use any other Dialogs to let me select one printer

The selection is returned by the Application.Dialogs(xlDialogPrinterSetup).Show Method.
Then even if that changed the active printer, you are restoring it back with the last line:
Application.ActivePrinter = wActPrinter
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,704
Members
449,048
Latest member
81jamesacct

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