Select printer based on If statement

Daksport00

New Member
Joined
Oct 25, 2005
Messages
4
Here is one for you. What I am trying to do is to select a printer, through an existing macro (that used 4.0 macro language, not VB) and sets it as the default.

The purpose for this is to run the macro automated, but different comptuers have a particular printer set to different ports.

=IF({"Canon on Ne03:"},"PRINTER.SETUP{""Canon on Ne03:""}","PRINTER.SETUP{""Canon on LPT2:""}")

Basically, I want the macro to look to port Ne03 for a printer named 'Canon'. If it finds it there then set is as default, if it is not there then set the printer named 'Canon" on port LPT2 as default.

but this doesnt work in code.

Some of your expert help here would be beneficial.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
ok, i finally got this one, after fidling with it for about 4 hours.

Here is the code I had to use:

=IF(R87C32=TRUE)
=PRINTER.SETUP("Canon on Ne03:")
=ELSE()
=PRINTER.SETUP("Canon on LPT2:")
=END.IF()

Cell R87C32 is the second line of the code.

Basically, a bad printer assignment returns a error (#Value!), which cannot be used in a If/Then statement. So the IF statement looks at the first printer assignment, if that is a true assignment, then it will use it, if not then it will use the alternate assignment.
 
Upvote 0

Forum statistics

Threads
1,224,387
Messages
6,178,294
Members
452,838
Latest member
TGirl66

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