MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Display available printers with vba


Posted by Josh on January 26, 2002 5:39 PM

Hi

I have several charts which are on a hidden sheet in excel and I show the charts on a userform. I have a button set up to print and it works fine, but what if the user has a couple of printers and they dont want to use the defauls printer. Is there a way to get the list of available printers on the users PC. Display them and then let the user choose one, then print to that printer?

Thanks

Josh


Posted by Ivan F Moala on January 26, 2002 6:55 PM

Probably the easiest way is the use the
excel Print Dialogs....there are other ways
to get the printers but this is more specific
to the type of job required.

Try;

Sub Show_printersetup()

Application.Dialogs(xlDialogPrinterSetup).Show


End Sub

Sub Show_print()

Application.Dialogs(xlDialogPrint).Show

End Sub

HTH


Ivan

Posted by Rich on April 02, 2002 4:06 AM

Is there anyway to not have a dialog box to choose the printer like you have suggested? Can you just set up something in the code to pick from a certain printer all the time that is not the default. I work in a company where every computer doesn't have the same default printer, yet I would like to be able to run a macro in Excel from any PC. Depending on how a printer is installed on a computer it may have to send with the code (ie. hp720 on NE04:). Windows 2000 and 98 handle the code in different ways. 98 doesn't need the NE..Whatever.