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 .ActiveDocument.PrintManager.UpdatePrinterBins .ActiveDocument.PrintManager.GetDefaultPageSize .ActiveDocument.PrintManager.UpdatePrinterChanges .ActiveDocument.PrintOut([From,][To,][Copies,][nodialog])
. .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: .ActiveDocument.PrintPreview
- Microsoft Excel:
As you'd expect, the commands are similar (exactly the same except for the parameters in this case) between Excel and Word:
ActivePrinter .PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate) PrintPreview
- Lotus 123:
Much like WordPro, but 123 has a lot more options. Here's the basics: Print: Application.PrintOut Preview: Application.Preview Printer Name: Application.PrinterName
Hope this helps!
Related Q&A from Todd Fuder
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.