VBA Word 2000: Print to multiple trays...

Posted on 2004-11-16
Last Modified: 2008-01-09

I have a LaserJet 4300 Printer with 4 Trays.
Tray 1 (Manual feed), Tray 2(Letterhead), Tray 3(Yellow/Color), Tray 4 (Plain)

I created a form where a user can choose to which tray they print to.

The code on the form is below:
Option Explicit

Private Sub cmdClose_Click()
End Sub

' Tray 1 - 264
' Tray 1 (Manual Feed) - 258
' Tray 2 (Letterhead) - 263
' Tray 3 (Colour) - 262
' Tray 4 (Plain) - 259

Private Sub OptionButton1_Click() 'Print 1st page to Letterhead Paper and following pages to plain
 With Selection.PageSetup
        .FirstPageTray = 263
        .OtherPagesTray = 259
    End With
End Sub

Private Sub OptionButton2_Click() 'Print all Pages to Colour Paper
    With Selection.PageSetup
        .FirstPageTray = 262
        .OtherPagesTray = 262
    End With
End Sub

Private Sub OptionButton3_Click() 'Print all pages to Plain Paper
    With Selection.PageSetup
        .FirstPageTray = 259
        .OtherPagesTray = 259
    End With
End Sub

Private Sub cmdPrint_Click() ' Print 1 copy to Letterhead (tray 2) + 1 copy to yellow paper (tray 3)
   If OptionButton4 = True Then
    End If
    Unload frmUSer

End Sub

All options work, except for the last one (optionbutton4, which prints a copy of the document to the letterhead tray and another to the colour tray).

This option is crashing Word 2000. When I check the print queue there are 2 jobs. The first one says its printing but nothing happens.

Is there something wrong with my code? Any suggestions on how I could fix this?

Question by:Priscilla_Hora

    Author Comment

    I think I may have found a fix to this problem.
    I have turned background printing off within word.. and guess what! It all works!!
    LVL 76

    Expert Comment

    Well done. Ask for a points refund in the Community Support area.

    Accepted Solution

    Question PAQ'd
    300 points refunded.

    Community Support Moderator

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now