Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change printer properties in excel macro

Is there any way I can change printer properties to color rather than black and white in an Excel macro/Excel VBA? I would like to print in color from the macro but every time I exit excel it sets the color to black and white. I would like for the macro to set the color back to color every time I run it. This is the code I am using to print:

Workbooks("Book1.xlsm").Worksheets("Sheet3").PrintOut from:=1, To:=(i / 2) - 0.5

This prints every page effected by the macro but it does it in black and white. I have already tried this but it didn't change anything:

Workbooks("Book1.xlsm").Worksheets("Sheet3").PageSetup.BlackAndWhite = False

If it isn't possible to do this in vba I would be fine with an API solution as well.

like image 349
Tim.DeVries Avatar asked Jun 09 '14 13:06

Tim.DeVries


1 Answers

Rather than using:

Workbooks("Book1.xlsm").Worksheets("Sheet3").PrintOut from:=1, To:=(i / 2) - 0.5

You could just use:

Workbooks("Book1.xlsm").Worksheets("Sheet3").PrintOut

and you can skip:

Workbooks("Book1.xlsm").Worksheets("DoNotDelete").PageSetup.BlackAndWhite = False

Because it only changes the worksheet settings, not the print settings.

But as far as printing in color goes you are probably best off just creating a shortcut the same printer twice in the control panel and set one to default color and another to default black and white. This way you can specify color or black/white just by which printer you choose.

like image 163
Jo Jo Avatar answered Sep 28 '22 03:09

Jo Jo