Setting Color through API

Maarten89

New Member
Joined
Jul 31, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I'm trying to create a macro to set the Color Options of an HP Universal Printing PCL 6 (v7.0.1) to print in color. Currently, the default Color Option is "Print in Grayscale" for all computers on our network. There is no chance of changing this default setting, but some forms still need to be printed in color. Forms are printed using a VBA macro and I was wondering if there was a way to write a function or sub that uses Windows API to uncheck the "Print in Grayscale" option so that I can call it in the macro that prints the form.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I cases like this I always advise to set up a copy of the same printer, with the required print settings, and use VBA to select that "printer" from the list.
 
Upvote 0
That was my first idea as well. I even wrote a script that finds and adds a printer's port to its name, so it can be found by all computers on our network. Sadly, the department responsible for printing reports uses a system with a tag-based virtual printing service. The print is sent to the virtual printer and logging in with a tag allows you to then print on any printer connected to the network.
 
Upvote 0
Correct. The printjob is sent to a virtual printer. The print is then parked on the badge print server until an employee uses their badge to log in to a physical printer and print the sent form. Sadly, I have no influence on the badge print service. The virtual printer reverts to greyscale on login and adding a new virtual printer with color print as default setting is not an option.
 
Upvote 0
That did the trick. I had to update the code for 64 bit and make some edits for my specific situation, but the macro does exactly what it's supposed to. Thanks, mr. Pieterse!
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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