Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
make a check form, and then have info go to a check register | Excel Worksheet Functions | |||
Copy and move check box (check boxes) with new cell link? | Excel Worksheet Functions | |||
Increase size of a Forms Check Box (click on to enter check mark) | Excel Discussion (Misc queries) | |||
Check if Conditional Format is True or False / Check cell Color | Excel Worksheet Functions | |||
Enable check box in protected sheet + group check boxes | Excel Discussion (Misc queries) |