Microsoft KB Archive/193243

= How To Set the Default Window's Printer Using OLE Automation =

Article ID: 193243

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q193243



SUMMARY
This article shows how you can use OLE automation to open the Printer Setup dialog box in Word 97 for Windows and change the default Windows printer.



MORE INFORMATION
Microsoft Word has the ability to open a Printer Setup dialog box that allows the user to select another printer as the default printer. The following code demonstrates how to accomplish this task: *** Begin code example *** oWord=CREATEOBJECT("Word.Application") dlg = oWord.Dialogs(97)  && Open printer setup dialog box in Word. WITH dlg .Show ENDWITH oWord.Quit When the code executes, a Printer Setup dialog box appears that contains the current Windows printers. From this dialog box, you can reset the current default printer. After choosing the printer, Word briefly appears but then closes.
 * End code example ***

