Microsoft KB Archive/216026: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 56: Line 56:


To select a new printer without having Word change the default system printer, use the WordBasic FilePrintSetup method with the DoNotSetAsSysDefault flag set to True. For example, instead of using the following code:
To select a new printer without having Word change the default system printer, use the WordBasic FilePrintSetup method with the DoNotSetAsSysDefault flag set to True. For example, instead of using the following code:
<pre class="codesample">  Set oWord = CreateObject(&quot;Word.Application&quot;)
<pre class="codesample">  Set oWord = CreateObject("Word.Application")
   oWord.ActivePrinter = &quot;HP LaserJet 4 on LPT2&quot;
   oWord.ActivePrinter = "HP LaserJet 4 on LPT2"
                 </pre>
                 </pre>
Use the following code.
Use the following code.
<pre class="codesample">  Set oWord = CreateObject(&quot;Word.Application&quot;)
<pre class="codesample">  Set oWord = CreateObject("Word.Application")
   oWord.WordBasic.FilePrintSetup Printer:=&quot;HP LaserJet 4 on LPT2&quot;, _
   oWord.WordBasic.FilePrintSetup Printer:="HP LaserJet 4 on LPT2", _
       DoNotSetAsSysDefault:=1
       DoNotSetAsSysDefault:=1
                 </pre>
                 </pre>

Latest revision as of 13:40, 21 July 2020

Knowledge Base


ActivePrinter property in Word sets system default printer

Article ID: 216026

Article Last Modified on 5/11/2007



APPLIES TO

  • Microsoft Office Professional 2007
  • Microsoft Office Professional Edition 2003
  • Microsoft Office XP Developer Edition
  • Microsoft Office 2000 Developer Edition
  • Microsoft Word 97 Standard Edition



This article was previously published under Q216026

SUMMARY

When you use the ActivePrinter property in Microsoft Office Word to set the current printer, you also set the printer you select to be the default printer for the system. If you do not want to change the setting for the default system printer, do not use the ActivePrinter property.

MORE INFORMATION

To select a new printer without having Word change the default system printer, use the WordBasic FilePrintSetup method with the DoNotSetAsSysDefault flag set to True. For example, instead of using the following code:

   Set oWord = CreateObject("Word.Application")
   oWord.ActivePrinter = "HP LaserJet 4 on LPT2"
                

Use the following code.

   Set oWord = CreateObject("Word.Application")
   oWord.WordBasic.FilePrintSetup Printer:="HP LaserJet 4 on LPT2", _
      DoNotSetAsSysDefault:=1
                

REFERENCES

For more information about the ActivePrinter property, click the following article numbers to view the articles in the Microsoft Knowledge Base:

162239 Sample code to retrieve the name of the active printer


177275 How to create a macro to change printer or fax driver



Additional query words: OFF2007 OFF2003

Keywords: kbautomation kbinfo KB216026