Paper Tray constans for MS Word for HP Color LaserJet CP1515n (5212 Views)
Reply
Occasional Visitor
ojacotdescombes
Posts: 2
Registered: ‎12-12-2013
Message 1 of 3 (5,212 Views)

Paper Tray constans for MS Word for HP Color LaserJet CP1515n

I'm trying to set the paper tray to the manual envelope feed with this VBA code (Word 2007):

 

mailmergeDoc.PageSetup.FirstPageTray = 6
mailmergeDoc.PageSetup.OtherPagesTray = 6
mailmergeDoc.PrintOut Copies:=NumberOfCopies

 

The numbers corresponding to the wdPaperTray constants have no effect (I tried several of them). Does my HP Color LaserJet CP1515n require different numbers?

Visitor
hacht
Posts: 3
Registered: ‎12-12-2013
Message 2 of 3 (5,193 Views)

Re: Paper Tray constans for MS Word for HP Color LaserJet CP1515n

[ Edited ]

I'm not sure what the number you are using would refer to. 

 

Have you tried this?

 

mailmergeDoc.PageSetup.FirstPageTray = "wdPrinterManualFeed" or "wdPrinterManualEnvelopeFeed" or "wdPrinterEnvelopeFeed"

mailmergeDoc.PageSetup.OtherPagesTray = wdPrinterManualFeed

mailmergeDoc.PrintOut Copies:=NumberOfCopies

 

 

 

-hacht-

I work for HP

Any information I may post is my own view
Occasional Visitor
ojacotdescombes
Posts: 2
Registered: ‎12-12-2013
Message 3 of 3 (5,179 Views)

Re: Paper Tray constans for MS Word for HP Color LaserJet CP1515n

[ Edited ]

I am actually using OLE-automation and late binding in Access (mailmergeDoc As Object). Therefore Word's wdPaperTray enumeration is not accessible to me. But since the enumeration constants are defined like wdPrinterManualFeed = 4, I simply use the numbers. I have done this sucessfully in similar situations.

 

The problem is that the driver of the LaserJet expects completely different constants. Finally I solved the problem with this little C# console application:

foreach (string p in PrinterSettings.InstalledPrinters) {
    PrinterSettings settings = new PrinterSettings { PrinterName = p };
    Console.WriteLine();
    Console.WriteLine(settings.PrinterName);
    foreach (PaperSource paperSource in settings.PaperSources) {
        Console.WriteLine("    PaperSource: Name = {0}, Kind = {1}, RawKind = {2}", paperSource.SourceName, paperSource.Kind, paperSource.RawKind);
    }
}
Console.ReadKey();

 It yields the following RawKind values:

  Automatically Select = 15

  Printer auto select = 257

  Manual Feed in Tray 1 = 258

  Tray1 = 259

  Tray 2 = 260

 

This works and prints the second page from the manual feed (VBA):

mailmergeDoc.PageSetup.FirstPageTray = 0
mailmergeDoc.PageSetup.OtherPagesTray = 258
mailmergeDoc.PrintOut Copies:=1

 

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.