Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Paper bins (WinXP / Word2003)

    In Word97 this Sub worked like a charm:

    Sub Page1DifferentBin
    Dim lngFirst As Long
    Dim lngRest As Long
    If Documents.Count > 0 then
    ProtOff 'Set doc protection off
    With activeDocument.PageSetup
    lngFirst = .FirstPageTray
    lngRest = .OtherPagesTray
    .FirstPageTray = wdPrinterLowerBin
    .OtherPagesTray = wdPrinterDefaultBin
    ActiveDocument.PrintOut
    .FirstPageTray = lngFirst
    .OtherPagesTray = lngRest
    ProtOn 'Set doc protection on
    End With
    End If
    End Sub

    This doesn't work in Word2003. On the lines .FirstPageTray = wdPrinterLowerBin / .OtherPagesTray = wdPrinterDefaultBin, I get Error 4608, Value out of range (translated from Dutch). I'm using the same network printers: HP Color LaserJet 4550 and HP LaserJet 4100, both with an additional 500 page bin.
    Substituting these wd-constants with their numbers (2, 0) doesn't help. In Word97 VBA Help, it states that FirstPageTray and OtherPagesTray are of type Long and Read/Write. But the Word2003 VBA Help doesn't mention the type at all, just Read/Write.
    Can anyone shed any light on this?

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

    Re: Paper bins (WinXP / Word2003)

    wdPaperTray is an Enum, which is basically a Long Integer. I would record a macro and set the paper trays while recording (in the Paper tab of File | Page Setup...). See which values are set for FirstPageTray and OtherPagesTray (amidst all the other code generated).

  3. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Paper bins (WinXP / Word2003)

    Thanks for the suggestion. Tried that and the values set were exactly the same as in my posted macro. But... it worked without error...!
    Run my macro again and it caused the error again. So I copied the lines from the recorded maco to my own macro, overwriting the exact same lines, and presto: it worked flawless... <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15> <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Can't explain this, other than some corruption in my global template than contains this macro's (the one posted and the one to reset the paperbins both to default). To be on the safe side I've exported all code and built a new global template.

Posting Permissions

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