Results 1 to 2 of 2

Thread: Printing: setting Trays - Word VBA !!!

Threaded View

  1. #1

    Thread Starter
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Unhappy Printing: setting Trays - Word VBA !!!

    Hello Distinguished Forum Members !!!

    I am having a very strange problem with certain 'previously saved' documents when printing them through a Print toolbar i have created in Word (xp) VBA.

    My print toolbar is very simple, it just allows users to print off specific types of documents on the correct paper & will print copies where they need them etc.

    Now i am using the following code to print !!

    VB Code:
    1. With ActiveDocument.PageSetup
    2.     .FirstPageTray = Tray
    3.     .OtherPagesTray = Tray2
    4. End With
    5.  
    6. Application.PrintOut FileName:="", Range:=Range, Item:= _
    7. wdPrintDocumentContent, Copies:=NoCopies, Pages:="", PageType:=wdPrintAllPages, _
    8. ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
    9. False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
    10. PrintZoomPaperHeight:=0

    I am passing in Tray, Tray2, NoCopies and Range, so i can control what is being printed out where.

    NOW the error occurs in these particular docs when i try and set the Trays !!!

    i get the error - 'Value out of range'

    And when i debug it error's on the following line

    VB Code:
    1. .FirstPageTray = Tray

    and if i mouse over the line the .FirstpageTray already seems to have a value of: 9999999, and will not let me change it to another value !!!

    The toolbar works with all new documents, and many saved ones, but on some saved docs i get this error which is very fustrating.

    Does anyone know why this occurs, or how to fix it ????

    Thanks
    Rich

    nb - VBCODE tags don't seem to be working for some reason !!!
    Last edited by NeedSomeAnswers; Feb 3rd, 2006 at 06:33 AM. Reason: Formatting Error in post

Posting Permissions

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



Click Here to Expand Forum to Full Width