Hi All,

I tried to make a macro to select a printer tray on our
MFD konica copier/printer at work which has 4 trays.

I recorded:

Sub Macro2()

'

' Macro2 Macro

' Macro recorded 17 September 2003 by AGG530

'

Selection.TypeText Text:="TEST BOTTOM TRAY'"

Selection.TypeParagraph

Selection.TypeBackspace

Selection.TypeBackspace

Selection.TypeParagraph

Selection.TypeParagraph

With Options

.UpdateFieldsAtPrint = False

.UpdateLinksAtPrint = False

.DefaultTray = "Tray 4"

.PrintBackground = False

.PrintProperties = False

.PrintFieldCodes = False

.PrintComments = False

.PrintHiddenText = False

.PrintDrawingObjects = True

.PrintDraft = False

.PrintReverse = False

.MapPaperSize = True

End With

With ActiveDocument

.PrintPostScriptOverText = False

.PrintFormsData = False

End With

Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _

wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _

Collate:=True, Background:=False, PrintToFile:=False

End Sub





This code works and I have run it a few times, it correctly prints from tray
4.



I inserted the code into my project and it does'nt work in my project. I
copied

everything using the clipboard except the sub and end sub.



I did msgbox options.defaulttray gives "tray 4"



So what am I doing wrong?



Cheers



- AL

Re: Printer tray selection...again.... by mksmith

mksmith
Wed Sep 17 02:24:30 CDT 2003

Does it fail on the same machine or on a different machine?

What I do to get the tray code number is to open up the recorder and then
go into the Page Setup and then get the values from there.

If I am handing the code about the firm I make sure that everyone has the
same printer driver on their machines. Perhaps this could be the
problem?

Malc
www.dragondrop.com

Re: Printer tray selection...again.... by Al

Al
Wed Sep 17 09:44:05 CDT 2003

The code I posted was from recorder!!

What to you mean code number? With recorder I got

>With Options
> .DefaultTray = "Tray 4"

Which seems obvious?

It would seem their are about three ways to pick the tray in Word;

File+Page Setup+Paper Source
File+Print+Properties (through printer driver)
File+Print+Options+Default Tray

Which is best?

Since the code I record works on its own, I wonder if their is'nt something
in my project that is changing the way the recorded code works?

Cheers

-Al


<mksmith@cix.compulink.co.uk> wrote in message
news:bk927e$cqk$1@thorium.cix.co.uk...
> Does it fail on the same machine or on a different machine?
>
> What I do to get the tray code number is to open up the recorder and then
> go into the Page Setup and then get the values from there.
>
> If I am handing the code about the firm I make sure that everyone has the
> same printer driver on their machines. Perhaps this could be the
> problem?
>
> Malc
> www.dragondrop.com



Re: Printer tray selection...again.... by Al

Al
Wed Sep 17 09:48:56 CDT 2003

Oh and I looked at the code on the mvps site. It talks about the
available options poping up when you type in the code.

This happens, and has upper/lower bins, manual feeds, etc
but does not talk about a 3rd or 4th bin!!

-AL

"Al & Cay Grant" <bigal_nz@no$spam.remove.hotmail.com> wrote in message
news:bk8lbq$8sb$1@lust.ihug.co.nz...
> Hi All,
>
> I tried to make a macro to select a printer tray on our
> MFD konica copier/printer at work which has 4 trays.
>
> I recorded:
>
> Sub Macro2()
>
> '
>
> ' Macro2 Macro
>
> ' Macro recorded 17 September 2003 by AGG530
>
> '
>
> Selection.TypeText Text:="TEST BOTTOM TRAY'"
>
> Selection.TypeParagraph
>
> Selection.TypeBackspace
>
> Selection.TypeBackspace
>
> Selection.TypeParagraph
>
> Selection.TypeParagraph
>
> With Options
>
> .UpdateFieldsAtPrint = False
>
> .UpdateLinksAtPrint = False
>
> .DefaultTray = "Tray 4"
>
> .PrintBackground = False
>
> .PrintProperties = False
>
> .PrintFieldCodes = False
>
> .PrintComments = False
>
> .PrintHiddenText = False
>
> .PrintDrawingObjects = True
>
> .PrintDraft = False
>
> .PrintReverse = False
>
> .MapPaperSize = True
>
> End With
>
> With ActiveDocument
>
> .PrintPostScriptOverText = False
>
> .PrintFormsData = False
>
> End With
>
> Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
>
> wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
>
> Collate:=True, Background:=False, PrintToFile:=False
>
> End Sub
>
>
>
>
>
> This code works and I have run it a few times, it correctly prints from
tray
> 4.
>
>
>
> I inserted the code into my project and it does'nt work in my project. I
> copied
>
> everything using the clipboard except the sub and end sub.
>
>
>
> I did msgbox options.defaulttray gives "tray 4"
>
>
>
> So what am I doing wrong?
>
>
>
> Cheers
>
>
>
> - AL
>
>
>
>
>
>
>
>
>
>
>



Re: Printer tray selection...again.... by Jonathan

Jonathan
Wed Sep 17 11:33:16 CDT 2003

Hi Al,

I've written a series of articles on printer control in Word. The first of
these goes into the issue of paper trays in quite a lot of detail, including
the questions you have asked. I think it might help you in your quest.

Controlling the Printer from Word VBA
Part 1: Using VBA to Select the Paper Tray
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com


"Al & Cay Grant" <bigal_nz@no$spam.remove.hotmail.com> wrote in message
news:bk9rvt$4gk$1@lust.ihug.co.nz...
> The code I posted was from recorder!!
>
> What to you mean code number? With recorder I got
>
> >With Options
> > .DefaultTray = "Tray 4"
>
> Which seems obvious?
>
> It would seem their are about three ways to pick the tray in Word;
>
> File+Page Setup+Paper Source
> File+Print+Properties (through printer driver)
> File+Print+Options+Default Tray
>
> Which is best?
>
> Since the code I record works on its own, I wonder if their is'nt
something
> in my project that is changing the way the recorded code works?
>
> Cheers
>
> -Al
>
>
> <mksmith@cix.compulink.co.uk> wrote in message
> news:bk927e$cqk$1@thorium.cix.co.uk...
> > Does it fail on the same machine or on a different machine?
> >
> > What I do to get the tray code number is to open up the recorder and
then
> > go into the Page Setup and then get the values from there.
> >
> > If I am handing the code about the firm I make sure that everyone has
the
> > same printer driver on their machines. Perhaps this could be the
> > problem?
> >
> > Malc
> > www.dragondrop.com
>
>