printer

  • Thread starter Thread starter Floyd Forbes
  • Start date Start date
F

Floyd Forbes

I have an application that I need to be able to print a report to one of two
printer.
I have this code below behind a command button. But I get Run-time error 5
Invalid procedure call or argument. I think the problem is the printer name
in quotes.


Application.printer = Application.Printers("HP Laser 4100")
Docmd.OpenReport "MyReportName",acViewNormal
Application.Printer = Nothing

Floyd
 
well, when you get the error message, which line of code is highlighted? if
it's the line that contains the printer name, then i'm wondering if the name
is correct. the syntax looks correct to me, at least according to VBA Help.
suggest you verify the printer name by running the following code, as

Dim prtLoop As Printer

For Each prtLoop In Application.Printers
Debug.Print prtLoop.DeviceName
Next prtLoop

check the Immediate window to see a list of the correct names of your
available printers.

hth
 
Back
Top