ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test Printer for Colour/BW (https://www.excelbanter.com/excel-programming/372722-test-printer-colour-bw.html)

Kieran H

Test Printer for Colour/BW
 
Greetings all

I have a number of programatically created reports that are tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print in
BW

How can I test for whether the default printer is colour or BW from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H


NickHK[_3_]

Test Printer for Colour/BW
 
Kieran,
What changes do you intend to make if the printer is B/W ?

NickHK

"Kieran H"
egroups.com...
Greetings all

I have a number of programatically created reports that are tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print in
BW

How can I test for whether the default printer is colour or BW from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H




Kieran H

Test Printer for Colour/BW
 
Nick,

Thanks for replying - my master plan was to write a function that would
return a boolean (FALSE) if the users default printer was colour.

Then set the ActiveSheet.PageSetup.BlackAndWhite property to the return
value

Perhaps not world domination but its a start! :)

Kieran H


NickHK wrote:
Kieran,
What changes do you intend to make if the printer is B/W ?

NickHK

"Kieran H"
egroups.com...
Greetings all

I have a number of programatically created reports that are tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print in
BW

How can I test for whether the default printer is colour or BW from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H



NickHK

Test Printer for Colour/BW
 
Kieran,
It certainly should be possible to determine if a printer is BW only from
one of the Printer_Info types.
Just wondering if it is worth it. If you send a colour print job to a BW
printer, doesn't the driver sort out the closest greyscale match ? Not sure
of quality of output.
Does this output (as above) differ much from setting BlackAndWhite to True
and then printing ?

NickHK

"Kieran H" wrote in message
oups.com...
Nick,

Thanks for replying - my master plan was to write a function that would
return a boolean (FALSE) if the users default printer was colour.

Then set the ActiveSheet.PageSetup.BlackAndWhite property to the return
value

Perhaps not world domination but its a start! :)

Kieran H


NickHK wrote:
Kieran,
What changes do you intend to make if the printer is B/W ?

NickHK

"Kieran H"
egroups.com...
Greetings all

I have a number of programatically created reports that are tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print in
BW

How can I test for whether the default printer is colour or BW from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H





NickHK

Test Printer for Colour/BW
 
Kieran,
Looks like you will need the OpenPprinter, GetPrinter, ClosePrinter APIs
with the PRINTER_INFO_2 and DEVMODE types, reading the value of dmColor
(http://msdn.microsoft.com/library/en...sp?frame=true).

This http://vb.mvps.org/samples/project.asp?id=PrnInfo gives the basics of
the required code.

But first decide if it is worth it.

NickHK

"NickHK" wrote in message
...
Kieran,
It certainly should be possible to determine if a printer is BW only from
one of the Printer_Info types.
Just wondering if it is worth it. If you send a colour print job to a BW
printer, doesn't the driver sort out the closest greyscale match ? Not

sure
of quality of output.
Does this output (as above) differ much from setting BlackAndWhite to True
and then printing ?

NickHK

"Kieran H" wrote in message
oups.com...
Nick,

Thanks for replying - my master plan was to write a function that would
return a boolean (FALSE) if the users default printer was colour.

Then set the ActiveSheet.PageSetup.BlackAndWhite property to the return
value

Perhaps not world domination but its a start! :)

Kieran H


NickHK wrote:
Kieran,
What changes do you intend to make if the printer is B/W ?

NickHK

"Kieran H"
egroups.com...
Greetings all

I have a number of programatically created reports that are

tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print

in
BW

How can I test for whether the default printer is colour or BW

from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H







NickHK

Test Printer for Colour/BW
 
Kieran,
OK, I have a class that will determine the colour mode. Let me know if you
want it.
However, I'm not sure if it returns the correct answer for an old dot matrix
printer that I have, all others (copier, fax, PDF, HP colour, HP black etc)
it returns the correct result.

NickHK

"Kieran H" wrote in message
oups.com...
Nick,

Thanks for replying - my master plan was to write a function that would
return a boolean (FALSE) if the users default printer was colour.

Then set the ActiveSheet.PageSetup.BlackAndWhite property to the return
value

Perhaps not world domination but its a start! :)

Kieran H


NickHK wrote:
Kieran,
What changes do you intend to make if the printer is B/W ?

NickHK

"Kieran H"
egroups.com...
Greetings all

I have a number of programatically created reports that are tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print in
BW

How can I test for whether the default printer is colour or BW from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H





Kieran H

Test Printer for Colour/BW
 
Nick,

Many thanks for your research, the class you described sounds exactly
what I need.

As for whether its worth it ?- It looks good on screen or printed in
colour but looks crap if printed in bw (the grey is too dark)

Poor code that still works may be criticised by my peers but with poor
presentation eveyone's a critic!

Thanks again

Kieran

NickHK wrote:
Kieran,
OK, I have a class that will determine the colour mode. Let me know if you
want it.
However, I'm not sure if it returns the correct answer for an old dot matrix
printer that I have, all others (copier, fax, PDF, HP colour, HP black etc)
it returns the correct result.

NickHK

"Kieran H" wrote in message
oups.com...
Nick,

Thanks for replying - my master plan was to write a function that would
return a boolean (FALSE) if the users default printer was colour.

Then set the ActiveSheet.PageSetup.BlackAndWhite property to the return
value

Perhaps not world domination but its a start! :)

Kieran H


NickHK wrote:
Kieran,
What changes do you intend to make if the printer is B/W ?

NickHK

"Kieran H"
egroups.com...
Greetings all

I have a number of programatically created reports that are tastefully
coloured (I hope!)

I am very happy for them to print on colour if the users default
printer is colour.

However if they have a BW printer I would like the report to print in
BW

How can I test for whether the default printer is colour or BW from
within Excel.

I'm guessing it will require an API call

Your thoughts would be appreciated

Cheers

Kieran H




NickHK

Test Printer for Colour/BW
 
Kieran,
Whilst you can send any valid printer name to the class, it only makes sense
to use the ActivePrinter.
However, if the user changes the printer in the printer dialog
(FilePrint..), you have no way of knowing which printer they selected and
hence no way to determine it colour capability, as the dialog is only shown
after your code has run.
If printed from the print icon, then the code works as written.

NickHK

"NickHK" wrote in message
...
Kieran,
See below for code, lifted from Karl's Printer Info code to only return

the
colour mode.

NickHK

"Kieran H" wrote in message
ups.com...
Nick,

Many thanks for your research, the class you described sounds exactly
what I need.

As for whether its worth it ?- It looks good on screen or printed in
colour but looks crap if printed in bw (the grey is too dark)

Poor code that still works may be criticised by my peers but with poor
presentation eveyone's a critic!

Thanks again

Kieran

NickHK wrote:
Kieran,
OK, I have a class that will determine the colour mode. Let me know if

you
want it.
However, I'm not sure if it returns the correct answer for an old dot

matrix
printer that I have, all others (copier, fax, PDF, HP colour, HP black

etc)
it returns the correct result.

NickHK

----------- CUT ----




Kieran H

Test Printer for Colour/BW
 
Nick - understood and much appreciated

will get to get to grips with it later on today

Again, many thanks

Kieran


NickHK wrote:
Kieran,
Whilst you can send any valid printer name to the class, it only makes sense
to use the ActivePrinter.
However, if the user changes the printer in the printer dialog
(FilePrint..), you have no way of knowing which printer they selected and
hence no way to determine it colour capability, as the dialog is only shown
after your code has run.
If printed from the print icon, then the code works as written.

NickHK

"NickHK" wrote in message
...
Kieran,
See below for code, lifted from Karl's Printer Info code to only return

the
colour mode.

NickHK

"Kieran H" wrote in message
ups.com...
Nick,

Many thanks for your research, the class you described sounds exactly
what I need.

As for whether its worth it ?- It looks good on screen or printed in
colour but looks crap if printed in bw (the grey is too dark)

Poor code that still works may be criticised by my peers but with poor
presentation eveyone's a critic!

Thanks again

Kieran

NickHK wrote:
Kieran,
OK, I have a class that will determine the colour mode. Let me know if

you
want it.
However, I'm not sure if it returns the correct answer for an old dot

matrix
printer that I have, all others (copier, fax, PDF, HP colour, HP black

etc)
it returns the correct result.

NickHK

----------- CUT ----




All times are GMT +1. The time now is 04:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com