• Paper bins (WinXP / Word2003)

    Author
    Topic
    #414978

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #924337

      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).

      • #924521

        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… shrug confused
        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.

    Viewing 0 reply threads
    Reply To: Paper bins (WinXP / Word2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: