How can I prevent Word/Excel from trying to reach the printer?

6

2

Whenever I perform certain operations in Word or Excel (2007), these applications are trying to reach the printer. I work on a laptop at work and at home. When I'm at home (not connected to my work's printer), I sometimes have to wait many seconds for Word/Excel to become responsive after performing operations such as making a cell bold in Excel, or pasting a paragraph from a webpage to Word.

In Word I may have a small message at the bottom saying something like "Trying to connect to the printer, press Esc to abort".

However

  1. That option does not exist in Excel

  2. and Sometimes if I do press Esc, Word crashes.

Is there a workaround?

Roee Adler

Posted 2009-08-30T17:46:35.133

Reputation: 1 448

Answers

8

My default printer is the PDF printer installed via CutePDF, which is free :)

As long as I have a local printer defined, and it's default, everything's fine.

I've seen the exact behavior you describe when switching fonts, and I think it's because some printers have allowable fonts, and Word is checking to see if they'll actually render on the printer (though why this is necessary until you actually print is beyond me).

warren

Posted 2009-08-30T17:46:35.133

Reputation: 8 599

Just made that change, but I'm currently connected to the network. I'll check if it works later, thanks. – Roee Adler – 2009-09-14T13:18:21.440

happy you're all set :) – warren – 2009-09-20T09:02:24.210

3

I think the only way to avoid this is by having a default printer that is not remote. Here is a simple JScript that will set your default printer to "Microsoft XPS Document Writer" (assuming you have it installed) which is always a local, non-hardware printer.

var network = new ActiveXObject("WScript.Network");
network.SetDefaultPrinter("Microsoft XPS Document Writer");

Save that as SetDefaultPrinter.js and you can either run it using the command line:

cscript //nologo SetDefaultPrinter.js

...or you could just save it to your desktop and double-click to run it.

bobbymcr

Posted 2009-08-30T17:46:35.133

Reputation: 1 992

2

One option would be something like this to automatically switch your printer based on IP address. It presumably could switch to none when you're at home.

Brett B

Posted 2009-08-30T17:46:35.133

Reputation: 21

1

Whilst you can check the ActivePrinter property in Excel 2007, you can't set it for some reason (even though you can in a Word VBA script). Here's the workaround in Excel VBA:

Set oWord = CreateObject(Class:="Word.Application")

oWord.ActivePrinter = NewDefaultPrinter$

oWord.Quit False

Set oWord = Nothing

It is especially useful to change the default printer if it's currently set to a network printer, as delays are experienced if the VBA macro modifies a workbook (delete columns etc) - it seems to check on the printer with each change made. To prevent this the default printer needs to be set to a local printer during the workbook modification process, then back again afterwards.

smileclick

Posted 2009-08-30T17:46:35.133

Reputation: 1

1

It might help to change your default printer to one that is defined locally.

There isn't an obvious (to me at least) rational reason for an application to interact with a printer when changing a font style, but if that is what is happening then at least a local printer won't be across an unconnected network.

RBerteig

Posted 2009-08-30T17:46:35.133

Reputation: 3 235

I don't have a local printer and I really like the fact I have my default printer defined as the work one (I print a lot) – Roee Adler – 2009-08-30T17:58:10.973

1

You could add a procedure to the ThisWorkbook/ThisDocument module of your personal.xls/normal.dot that would detect if you were at home and set the printer default appropriately.

I've not tested this, but USERDOMAIN (index 30) should be suitable for this purpose. The following code should give you a rough idea of what is required to do this.

Sub checkDomain()
    Dim desiredPrinter As String

    If Environ(30) = "USERDOMAIN=YOURWORKDOMAIN" Then
        'Set work default printer
        desiredPrinter = "\\NetworkAddress\Work Printer on Ne04:"
    Else
        'Set home default printer
        desiredPrinter = "Microsoft XPS Document Writer on Ne01:"
    End If

    If Not Application.ActivePrinter = desiredPrinter Then
        Application.ActivePrinter = desiredPrinter
    End If
End Sub

Note that the ports will likely be different on your PC, you can run the following code to check what VBA thinks your printers are called.

Sub PrinterList()
    Dim objWMIService
    Dim colInstalledPrinters
    Dim objPrinter
    Dim strPrinterName As String
    Dim strComputer As String

    strPrinterName = Application.ActivePrinter
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer ")

    For Each objPrinter In colInstalledPrinters
        If objPrinter.PrinterStatus = 1 Or objPrinter.PrinterStatus = 2 Or objPrinter.PrinterStatus =     7 Then
            Debug.Print "offline:" & objPrinter.Name
        Else
            If InStr(strPrinterName, objPrinter.Name) Then
                Debug.Print objPrinter.Name & "*"
            Else
                Debug.Print objPrinter.Name
            End If
        End If
    Next
End Sub

This will list all installed printer names in the Immediate window of the Visual Basic Editor (CTRL+G for the Immediate window if you're not very familiar with VBA)

Lunatik

Posted 2009-08-30T17:46:35.133

Reputation: 4 973

0

Another solution is to simply disable the display of page breaks on the slow tab(s). You can see an example of this here: http://blogs.mccombs.utexas.edu/the-most/2010/02/17/hidepagebreaks/

The print communication is often because Excel is trying to constantly repaginate your sheet, which is expensive and generally unnecessary. I have seen good performance improvements by simply disabling that option.

aaronsteers

Posted 2009-08-30T17:46:35.133

Reputation: 236