Automated Word printing stops Excel printing

G

Guest

Hi,

I have an VB.NET (1.1) application which includes batch printing using
Word automation (Office 2003). As soon as Word has printed just one
item, Excel (whether it's running at the time or not) then refuses to
print to the same printer. The printing dialog appears, and it's has
the progress screen flash up as if it was printing as normal... but
the printer does nothing.
(I've confirmed winword.exe no longer exists in the processes.)

If I get Excel to print to a different printer (such as the MS
document image writer) it prints correctly - and then when I try the
original printer again, it works.

If you want to try it yourself, the following VBS code is pretty much
line for line the same as the VB.NET code and should make your Excel
not print. (I've tested it with 3 different machines.)

Dim doc
Set doc = CreateObject("Word.Application")
doc.Documents.Open "C:\print_test.doc", False
doc.ActivePrinter = "{printer name removed}"
doc.PrintOut
doc.Documents.Close False
doc.Quit
Set doc = nothing

I've run out of ideas... anybody?

Many thanks,
Tom
 
J

Jonathan West

Try this

Dim doc
Dim sPrinter
Set doc = CreateObject("Word.Application")
doc.Documents.Open "C:\print_test.doc", False
sPrinter = doc.ActivePrinter
doc.ActivePrinter = "{printer name removed}"
doc.PrintOut False
sPrinter = doc.ActivePrinter
doc.Documents.Close False
doc.Quit
Set doc = nothing

there are two key changes

1. The original printer name is restored after printing
2. Background printing is set to False for the printout
 

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