Try something like this:
------------------Code:Private Sub Command1_Click() Dim sLastPrinter As String sLastPrinter = SetPrinter("Generic / Text-Only") If Len(sLastPrinter) Then 'Printer Switched Successfully, do the Printing.. Printer.Print "Printing with a Different Printer.." Printer.EndDoc 'Switch Back to the Original Printer Call SetPrinter(sLastPrinter) End If End Sub Function SetPrinter(ByVal PrinterName As String) As String Dim oPRINTER As Printer For Each oPRINTER In Printers If LCase(oPRINTER.DeviceName) = LCase(PrinterName) Then 'Found Specified Printer, Switch to it.. SetPrinter = Printer.DeviceName Set Printer = oPRINTER Exit For End If Next End Function
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Certified AllExperts Expert




Reply With Quote