Printer control code

L

lindak

Hi there
I've successfully used the printer control code in a word macro to print
particular sections of a document in duplex mode. Its been working for a
year or 2 without a problem.

My question is this - our organisation is rolling out new pcs running windows
XP (previously used Windows 2000). For XP users the macro fails, while it
still works for people who still have Windows 2000. I've isolated it to this
section of the macro:

iRet = OpenPrinter(sPrinterName, hPrinter, pd)
If (iRet = 0) Or (hPrinter = 0) Then
'Can't access current printer. Bail out doing nothing
Exit Function
End If

This is where the code bails. I wonder if there is some added security (or
antivirus control?) somewhere (the printers are networked printers) which is
not allowing access to the printer ....

Would appreciate any ideas anyone may have.

thanks
 
J

Jonathan West

Hi lindak,

Install a local copy of the printer driver. Code such as OpenPrinter doesn't
work on network printers unless you cave a local copy of the driver
installed.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
L

lindak via OfficeKB.com

Jonathan said:
Hi lindak,

Install a local copy of the printer driver. Code such as OpenPrinter doesn't
work on network printers unless you cave a local copy of the driver
installed.

Thanks - I will try this and let you know what happens!
 

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

Similar Threads


Top