SelectedPrinter name on A1 without changing the ActivePrinter

drom

Active Member
Joined
Mar 20, 2005
Messages
450
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
  6. 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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,253
Office Version
  1. 2016
Platform
  1. Windows
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
 

drom

Active Member
Joined
Mar 20, 2005
Messages
450
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
  6. 2007
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
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,253
Office Version
  1. 2016
Platform
  1. Windows
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
 

Forum statistics

Threads
1,136,327
Messages
5,675,128
Members
419,551
Latest member
thangxpm

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
Top