Wikipedia:Reference desk/Archives/Computing/2014 June 30
Appearance
Computing desk | ||
---|---|---|
< June 29 | << May | June | Jul >> | July 1 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
June 30
[edit]Simple C# printing file from VBA
[edit]Hi,
I have some VBA code that prints off an MS word document as specified by the user. However as far as I can tell, it's impossible to set the printer settings through VBA, so I'm trying another approach. Basically I need two .exe files, one which sets the default printer setting to color, and another to print in black and white. Running these from the VBA code could allow me to choose whether the file printed is in B&W or color. However I'm not a great C# programmer, could someone point me in the right direction, or give some simple sample code? Thanks 194.205.13.211 (talk) 15:16, 30 June 2014 (UTC)
- This MSDN article describes how to use the Printer object in VBA. You shouldn't need a separate application. Specifically, the lines you need are:
Application.Printer.ColorMode = acPRCMMonochrome
and
Application.Printer.ColorMode = acPRCMColor