Finding printer trays and selecting which to print to from a word document using VB

  • Thread starter Thread starter Hmmcrunchy
  • Start date Start date
H

Hmmcrunchy

Guest
HI Folks


I'm using VS2019 to program in visual basic, below is a very frustrating issue im trying to accomplish

AIM:

  • To create a word document using Dim oWord As Word.Application - Complete
  • Add bookmarks to the document - complete
  • To then print the document to the default printer (whatever model) using a tray specified in the incoming csv data

the last point is the issue, I cant print the document using oWord.ActiveDocument.PrintOut() no problem but my issue is the changing of the tray numbers

CURRENT ATTEMPTS :

  1. oWord.ActiveDocument.PageSetup.FirstPageTray = Word.WdPaperTray.wdPrinterLowerBin - doesnt print out from other tray also used otherpagestray
  2. oPS.DefaultPageSettings.PaperSource = oPS.DefaultPageSettings.PrinterSettings.PaperSources.Item("Tray 3") with oPS As New System.Drawing.Printing.PrinterSettings -- is it find the paper sources in the oPS I can msgbox them and see "Tray 2" etc but cant seem to set the print to go to them
  3. tried a print dialog, but the users doesn't want this extra layer as a lot of these are automated

ideally id just need to print to tray X, from the data sent no matter what printer it is. failing that I can catch any error and print from the printer default tray

I'd hoped printing was well integrated into VS, being able to print to trays easily but I seem to be having a hard time doing it

Any ideas very welcome indeed

Thanks.

Continue reading...
 
Back
Top