Printing a Form to a specific Printer

  • Thread starter Thread starter Fester
  • Start date Start date
F

Fester

Is there a way to print a form to a specific printer instead of the
Windows default? I tried to set the printer name but it errors out.

Fester
 
You could add a Print button, and add this code


Private Sub cmdPrint_Click()
Dim fOK As Boolean
Dim sPrinter As String


With Application
sPrinter = .ActivePrinter
fOK = .Dialogs(xlDialogPrint).Show
End With


If fOK Then
Me.PrintForm
Application.ActivePrinter = sPrinter
End If
End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)
 
It allows me to select the printer, but it only prints the worksheet
and then prints the form to the Windows default again. Am I stating
this correctly?
 
Sorry, I gave you the wrong dialog, should be

Private Sub cmdPrint_Click()
Dim fOK As Boolean
Dim sPrinter As String

With Application
sPrinter = .ActivePrinter
fOK = .Dialogs(xlDialogPrinterSetup).Show
End With

If fOK Then
Me.PrintForm
Application.ActivePrinter = sPrinter
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top