Problem solve Get help with specific problems with your technologies, process and projects.

Tell Excel or Word to select a printer before printing

This has more to do with the integration between VBA and Lotus Script. How do you tell Excel or Word to select a printer before printing? If this cannot be done, then what about how do I call up a 'Print Preview' instead?

I'll try to give you as much info as I can, since this might be useful in general, as well, to others:

The Print verb is a reserved word in OLE, so it can't be directly called, normally. Several applications (such as WordPro) have created "alternative" methods you can call in its place. These verbs, whichever they are, usually only tell the host application to print (with or without displaying the dialog box).

To Change the Printer Name property:
'This example script sets the current document's printer to the HP LaserJet
	'4L, printing to LPT1:.

	.ActiveDocument.PrintManager.PrintDestination = "LPT1:"
	.ActiveDocument.PrintManager.PrinterName = "HP LaserJet 4L"
	.ActiveDocument.PrintManager.UseDefaultPrinter = True
Microsoft Word:
. .ActiveDocument.PrintOut(Background, Append, Range, OutputFileName, From, To, Item,Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint)
	'To select the active printer...
	ActivePrinter = "HP LaserJet IIISi on \printerslaser"
	This example makes a local HP LaserJet 4 printer on LPT1 the active printer. 
	ActivePrinter = "HP LaserJet 4 local on LPT1:"

	'To get a print preview from Word:
Microsoft Excel:
As you'd expect, the commands are similar (exactly the same except for the parameters in this case) between Excel and Word:
	.PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate)
Lotus 123:
	Much like WordPro, but 123 has a lot more options.  Here's the basics:



	Printer Name:

Hope this helps!

Dig Deeper on LotusScript



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...