print button command to select printer

  • Thread starter Thread starter johnlute
  • Start date Start date
J

johnlute

Is there a code that will open up the Select Printer dialog box so
that you can select a printer?

Thanks!
 
I believe you would have to either use the common dialog control, or manually
populate a list of printers to pick from. The following will populate a
combo:


Private Sub FillPrinterCombo
Dim prtLoop As Printer

' Don't forget to set the RowSourceType = "Value List"

For Each prtLoop In Application.Printers
cboPrinters.AddItem(prtLoop.DeviceName)
Next prtLoop

End Sub

And then when they select a printer in the combo, set the printer as follows:

Set Application.Printer = Application.Printers(cboPrinters)
 
Hi Ray

Thanks for this code - just what i was looking for but how do I use it?
Where would I put this code and how would I call it? Tried creating it in a
module and then on gotfocus of combo calling it, but this didn't work - get
error unknown function defined.
 
Back
Top