printer

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
 
T

tina

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top