Results 1 to 14 of 14
  1. #1
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro Problem (2002/SR2)

    I'm running the same macro on two different machines to do the same job (send an envelope file to the envelope printer, and then put the default printer back to HP Laser Jet 4). I give the code below.
    On one system it works fine--on the other, the macro changes the default printer, but the print command refuses to work--Word just hangs.

    One factor which may or may not be complicating the situation is that the printer and the printer driver being used on the offending system is in fact not a Xerox DocuPrint, but a Canon BJ, and I've simply renamed the driver--I've done this, because the two systems need to use the same database for general office management.

    Has anyone any ideas

    best wishes

    Philip

    ActivePrinter = "Xerox DocuPrint-M760"
    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 = "HP LaserJet 4"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro Problem (2002/SR2)

    Does it work on the offending computer if you give the printer driver its correct name and use that in the macro? (I know this is not what you want, but this is for testing purposes)

  3. #3
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    Thanks. The problem remains if I just accept the name for the printer that Windows gives it. I'm wondering if it could be something to do with the macro program not picking up the port--the printer is connected to the computer's USB001 port, through a USB/parallel converter.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro Problem (2002/SR2)

    Try the following:
    - Select File | Print...
    - Select the printer from the Name dropdown list.
    - Click Close.
    - Activate the Visual Basic Editor (Alt+F11).
    - Activate the Immediate window (Ctrl+G).
    - Type ? ActivePrinter and press Enter.
    - The result will probably include the port number (<printername> on <portname>).
    - Copy this result to the clipboard, and paste it into your code:
    ActivePrinter = "<printername> on <portname>"
    - Do the same for the standard printer (the HP LaserJet)

  5. #5
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    Thanks for this. It doesn't seem to shift the problem, however.

    My code now looks like
    ActivePrinter = "Xerox DocuPrint-M760 on NE00"
    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 = "HP LaserJet 4 on LPT1"

    It may be that I'm misreading your instructions, which came through to me as

    Copy this result to the clipboard, and paste it into your code:
    ActivePrinter = "<printername> on <portname>"
    - Do the same for the standard printer (the HP LaserJet)

    It's also the case that the Canon printer is actually on USB001.

    many thanks

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro Problem (2002/SR2)

    Does <code>ActivePrinter = "Xerox DocuPrint-M760 on USB001"</code> work? Somehow, I doubt it. I have no other ideas, sorry.

  7. #7
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    no--I'd had that idea already. I am reading your code right, aren't I?

    Thanks for all your help

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro Problem (2002/SR2)

    Yes, you interpreted my suggestion correctly, but unfortunately it didn't work, so I'm stumped.

  9. #9
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    You *can* print from the user interface, can you?
    And when you record changing the printer to that Canon BJ and print, the page is printed, but the recorded code doesn't work?

    That does seem strange...
    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  10. #10
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    Not quite
    I can print from the user interface
    When I run the macro, the default printer changes in Windows Control Panel, but Word hangs before it actually prints anything.

    It is all rather odd--I'm beginning to wonder if there is something odd somewhere inside the Windows installation

    best wishes

    Philip

  11. #11
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    Did you get the macro by changing the printer in the user interface, and recording that?

    Sorry that I'm out of ideas too. There are some troubleshooting guides, but without any error message to go by, troubleshooting will be difficult.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  12. #12
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    Running another macro on the machine, I've isolated the problem--it's with getting the macro command that changes the printer to work. A macro that used to work perfectly well that involved that kind of move now doesn't. Could my VBA installation be corrupt?

  13. #13
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    > Could my VBA installation be corrupt?

    Since it seems you've made sure you got ActivePrinter = "..." right --
    My gut feeling is that it's more likely a problem with the installed printer (or USB) drivers.
    But that is only a guess, and I hope somebody else can give you better help.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  14. #14
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Problem (2002/SR2)

    many thanks. I think I might have a go at reinstalling Windows--though I'll stop short of a reformat.

    best wishes

Posting Permissions

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