Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set the default printer for a VB report

Status
Not open for further replies.

Dimondwoof

Programmer
Dec 9, 2002
6
US
Does anyone know how to set the default printer in a VB6 app in Windows 2000? I've tried the Set Printer command from the printers collection and that doesn't seem to do a thing. Here's my code:

For Each X In Printers
If X.DeviceName = "Certificate Printer" Then
Msgbox "Found Printer"
' Set printer as system default.
Set Printer = X
' Stop looking for a printer.
Exit For
End If
Next

I get the "Found Printer" dialog, but the default printer is never set. Any ideas?

I would prefer NOT to set the printer in Windows, since this is a specialized printer for printing special card stock and nothing else in Windows (or this program for that matter) prints to this printer. But if that is the only solution, I could live with it.
 

What you could do is use the SetDefaultPrinter API to set the default printer to your special printer. Then print out the report and then set the default printer back to the printer it was before.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top