NeedSomeAnswers
Feb 3rd, 2006, 05:28 AM
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 !!
With ActiveDocument.PageSetup
.FirstPageTray = Tray
.OtherPagesTray = Tray2
End With
Application.PrintOut FileName:="", Range:=Range, Item:= _
wdPrintDocumentContent, Copies:=NoCopies, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
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
.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 !!!
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 !!
With ActiveDocument.PageSetup
.FirstPageTray = Tray
.OtherPagesTray = Tray2
End With
Application.PrintOut FileName:="", Range:=Range, Item:= _
wdPrintDocumentContent, Copies:=NoCopies, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
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
.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 !!!