Results 1 to 5 of 5

Thread: Losing printer

  1. #1
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Losing printer

    Scenario:
    Office 2K. Word is open, Excel is open
    In Word, I have recorded a macro that changes printer to the fax. As soon as I run it, Excel loses its printer!
    Macro:
    <pre> Application.ActivePrinter = "RelayFax Printer Driver"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
    wdPrintDocumentContent, Copies:=1, Pages:="",
    PageType:=wdPrintAllPages, _
    Collate:=True, Background:=True, PrintToFile:=False,
    PrintZoomColumn:=0, _
    PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
    Application.ActivePrinter = "HP LJ 4"
    </pre>


    Now, when I go to Excel: File/Print... , I see:
    Name: <blank field>
    Status: Idle
    Type: Test Fax Driver
    Where: FAXREDIR

    This happens as soon as the Fax Window opens up in Word - i.e. before the macro completes.

    Anyone got any clue as to what is going on?

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Losing printer

    OK, found the problem but not the reason.
    The above was recorded as a macro. If I put in debug watches for the active.printer name, they actually resolve to:
    "RelayFax Printer Driver on Ne00:"
    and
    "HP LJ 4 on LPT1:"

    However, two odd things still remain:
    1] As soon as Word sets the active.printer to the fax driver, Excel shows it as it's printer. It reverts to the HPLJ4 at the end of the macro. An equivalent macro run from Excel does not affect the printer setting in Word.
    2] Setting the active.printer in Word causes a delay (hourglass) of 4-5 seconds. In Excel, it is almost instantaneous.

    Any insight into what is going on would be appreciated.

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Losing printer

    Hi Leif,
    It would appear that when you run Application.ActivePrinter (or even Word.ActivePrinter) from Word, it actually changes the default printer setting in Control Panel. I guess that is why Excel then chooses the same printer. Running the code from Excel does not appear to change the default printer. As to why this should happen, I have no idea!
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Losing printer

    Yes, it does change the default.
    I came across the MS admission of guilt here where they state:
    "To resolve this problem, use a variable to store the current printer name, and then reset the active printer to the stored value after using the ActivePrinter property."

    Unfortunately, this makes no difference. I even copied their example to make sure I got it right....
    [img]/w3timages/icons/crazy.gif[/img]

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Losing printer

    I guess it's not a problem really as long as you reset the printer at the end of the code but it's still typical! It does however take less than a second on my PC to change the printer in Word so I'm stumped as to why yours should take so long. Sorry...
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •