Detecting which printer was chosen

kingnutin

Board Regular
Joined
Jun 15, 2005
Messages
67
How can I detect which printer was chosen form the xlDialogPrinterSetup function? At any given time my users can choose to print to a fax, a printer, or a pdf. I would like it to be so that if the printer that was selected was the "Adobe PDF" printer, it would do a sendkeys function to designate the name of the file, otherwise it would just print as normal.

If Application.Dialogs(xlDialogPrinterSetup).Show Then
*** IF PRINTER SELECTED IS ADOBE PDF THEN SENDKEYS FILENAME ***
*** END IF ***
Sheets(SomeSheetName).PrintOut Copies:=1, Collate:=True
End If
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Add this after your If Dialog select. It will give you the currently selected printer.

MsgBox Application.ActivePrinter

HTH
Cal

PS-I'm using XL2003
 
Upvote 0
I just thought of that! We must be on the same wavelength or something.

What if I made it so that there is a string that Application.ActivePrinter is associated with. How may I make it so that I can search that string to see if it contains "Adobe PDF"
i.e.

someString = Application.ActivePrinter
IF SOMESTRING CONTAINS "Adobe PDF" THEN BLAH BLAH BLAH

Thanks for the reply!
 
Upvote 0
Something like this.

Code:
If Application.ActivePrinter Like "*Adobe PDF*" Then
    MsgBox "Found"
End If

HTH
Cal
 
Upvote 0

Forum statistics

Threads
1,207,402
Messages
6,078,270
Members
446,324
Latest member
JKamlet

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