Microsoft KB Archive/285885

= Prompt to save Normal.dot when using Word as an automation server =

Article ID: 285885

Article Last Modified on 1/29/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Office Word 2003
 * Microsoft Word 2002 Standard Edition
 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q285885



SYMPTOMS
When you automate multiple instances of Microsoft Word simultaneously, the user may receive one or more of the following warnings:

&quot;Normal.dot was being edited by another Word session. If you save this document with the original name, you will overwrite any changes made in the other session. Do you want to save the document using the original name anyway?&quot;

-or-

This file is in use by another application or user. (C:\Documents and Settings\...\Normal.dot)

These warnings may occur if changes are made to the Normal.dot template.



RESOLUTION
To resolve this problem, do one of the following:   Before you quit Word or transfer control to the user, set the Saved property of the Normal.dot template to True as follows: Application.NormalTemplate.Saved = True -or-

  Set the SaveChanges argument for the Quit method as follows: Application.Quit SaveChanges:=wdDoNotSaveChanges 



Steps to Reproduce Behavior
 In Visual Basic, create a new Standard EXE project. Form1 is created by default. On the Project menu, click References, and then add a reference to your version of the Microsoft Word Object Library. Add a CommandButton control to Form1.</li>  Add the following code to the form: Private Sub Command1_Click Dim wdApp1 As Word.Application Dim wdApp2 As Word.Application Set wdApp1 = CreateObject(&quot;Word.Application&quot;) wdApp1.Visible = True wdApp1.Documents.Add Set wdApp2 = CreateObject(&quot;Word.Application&quot;) wdApp2.Visible = True wdApp2.Documents.Add MsgBox &quot;Change the default font of document 2.&quot; wdApp2.ActiveDocument.Close False wdApp2.Quit Set wdApp2 = Nothing

wdApp1.Quit Set wdApp1 = Nothing End Sub </li> Run the Visual Basic project and click the command button.</li> A message box directs you to change the default font for the second document. On the Format menu, click Font, and then click Default. When you are prompted to change the default font, click Yes, and then click OK to dismiss the message box.</li></ol>

When the second Word instance is closed, one of the warnings shown in the &quot;Summary&quot; section appears.

To resolve this issue in the code above, do one of the following:   Add the following line before the call to the wdApp2.Quit method: wdApp2.NormalTemplate.Saved = True

-or-

</li>  Use the SaveChanges argument of the Quit method as follows: wdApp2.Quit SaveChanges:=wdDoNotSaveChanges </li></ul>

Additional query words: kbofficeprog

Keywords: kbautomation kbprb KB285885

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.