PDA

View Full Version : Solved: Word macro disables printing in excel?



mSh
08-21-2008, 11:58 PM
Hi all,

I have a word macro, when running it, it disables printing in excel. It is impossible to print a document from excel after running this macro.

I am running office 2003 on a windows 2000 professional

The macro code is the following (this is not the actual code, but when running this code, the same problem occures)


ActivePrinter = "\\N318416\PRINT019 NRG P7527n"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
ActivePrinter = "\\N318416\PRINT050 KM bizhub 420"

I have set my activeprinter twice, because apparently the activeprinter line changes the standard printer, so i have to put it back to the original standard printer
Try copying my macro in word, run it (change the printernames first though) and then open excel and try pressing the printbutton... nothing will happen

Has someone have any suggestions in how to solve this problem?
Thanks in advance

edit: i'm running word 2003 (11.8134.8132) SP2 and excel 2003 (11.8146.8132) SP2

Nelviticus
08-22-2008, 02:47 AM
It works for me, so the problem must be something else. You could try storing the original printer then reinstating it afterwards, like this:
Dim sOriginalPrinter As String
sOriginalPrinter = ActivePrinter
ActivePrinter = "My Target Printer"
Application.PrintOut
ActivePrinter = sOriginalPrinter
If that doesn't work, try doing a repair of your Office installation.

mSh
08-22-2008, 03:20 AM
The only way to let it work when using the code i posted, is selecting another printer in excel. When i do that, the file will be printed, but when i only press the print button (nothing else), then the file won't be printed

But i tried the code you posted. If I use that code, there are no problems at all???? I have no idea why this works, and my original code won't work.. Let's just blame microsoft :)

Thank you very much for your reply, it works now