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



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury