Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Check available pagesize

Is it possible to check if a printer (on the network) can handle a certain
page size, for instants A2 size???
I've solved it for now by error handling during setting of page size, by
asking to select an other printer. Problem is that when a second printer is
chosen that also doesn't support A2 paper size the macro stops on error......

Suggestions anyone???



--
-----------------------------

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Check available pagesize

Hi Gerard,

'------------------
Is it possible to check if a printer (on the network) can handle a certain
page size, for instants A2 size???
I've solved it for now by error handling during setting of page size, by
asking to select an other printer. Problem is that when a second printer is
chosen that also doesn't support A2 paper size the macro stops on
error......
'------------------

See the MSDN Article:

Retrieving Printer Capabilities
http://tinyurl.com/4khvy


---
Regards,
Norman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Check available pagesize

I think you can use this:



Sub PrinterPaperSizes()

Computer = "."
Set WMISrv = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& Computer & "\root\cimv2")

Set Printers = WMISrv.ExecQuery _
("Select * from Win32_Printer ")

For Each Printer In Printers
For Each pn In Printer.PrinterPaperNames
Debug.Print Printer.Name & " supports " & pn
Next
Next

End Sub


It should return available paper sizes for all printers .

If you want the information just for one printer you need to specify the
printer name:

Set Printers = WMISrv.ExecQuery _
("Select * from Win32_Printer " & _
"Where Name = 'HP LJet 1020'")

You could use Printer.PaperSizesSupported instead of
Printer.PrinterPaperNames, but then you would have to map paper sizes to ints
( A2 = 20 ...)

For Each ps In Printer.PaperSizesSupported
Debug.Print Printer.Name & " supports " & ps
Next


Hope this helps some.

--
urkec


"GerardV" wrote:

Is it possible to check if a printer (on the network) can handle a certain
page size, for instants A2 size???
I've solved it for now by error handling during setting of page size, by
asking to select an other printer. Problem is that when a second printer is
chosen that also doesn't support A2 paper size the macro stops on error......

Suggestions anyone???



--
-----------------------------

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Check available pagesize

Norman and ukec,
Thanks for the info it's both very useful.

Greetings and many thanks
Gerard
--
-----------------------------



"urkec" wrote:

I think you can use this:



Sub PrinterPaperSizes()

Computer = "."
Set WMISrv = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& Computer & "\root\cimv2")

Set Printers = WMISrv.ExecQuery _
("Select * from Win32_Printer ")

For Each Printer In Printers
For Each pn In Printer.PrinterPaperNames
Debug.Print Printer.Name & " supports " & pn
Next
Next

End Sub


It should return available paper sizes for all printers .

If you want the information just for one printer you need to specify the
printer name:

Set Printers = WMISrv.ExecQuery _
("Select * from Win32_Printer " & _
"Where Name = 'HP LJet 1020'")

You could use Printer.PaperSizesSupported instead of
Printer.PrinterPaperNames, but then you would have to map paper sizes to ints
( A2 = 20 ...)

For Each ps In Printer.PaperSizesSupported
Debug.Print Printer.Name & " supports " & ps
Next


Hope this helps some.

--
urkec


"GerardV" wrote:

Is it possible to check if a printer (on the network) can handle a certain
page size, for instants A2 size???
I've solved it for now by error handling during setting of page size, by
asking to select an other printer. Problem is that when a second printer is
chosen that also doesn't support A2 paper size the macro stops on error......

Suggestions anyone???



--
-----------------------------

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
make a check form, and then have info go to a check register richie g Excel Worksheet Functions 0 May 5th 10 12:10 AM
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM


All times are GMT +1. The time now is 06:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"