Microsoft KB Archive/155991

= WD97: Title Bar File Name Is Not Updated When You Use ActiveWindow.Caption =

Article ID: 155991

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q155991





SYMPTOMS
When you use the ActiveDocument.ActiveWindow.Caption statement in a Microsoft Visual Basic for Applications macro (for example, a FileSaveAs or FileOpen macro), Word fails to update the title bar when you save the document with a new file name.

NOTE: Word saves the document but does not update the title bar in the open document. When you close and reopen the document, the title bar displays the correct file name.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Word 2000.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

173707 OFF97: How to Run Sample Code from Knowledge Base Articles

This problem can best be demonstrated by using the following steps:  Start Word. On the Tools menu, point to Macro and then click Macros. In the Macros dialog box, change the Macros in box to Word Commands. In the Macro names list, click to select FileOpen. Change the Macros in box to the template that you want the macro saved to (for example, Normal.dot (global template)), and then click Create.  Change the FileOpen macro to the following: Sub FileOpen

Dialogs(wdDialogFileOpen).Show ActiveDocument.ActiveWindow.Caption = _ ActiveDocument.ActiveWindow.Caption + " - My Caption"

End Sub </li> On the File menu, click Close and Return to Microsoft Word.</li> On the Tools menu, point to Macro and then click Macros.</li> In the Macros dialog box, change the Macros in box to Word Commands.</li> In the Macro names list, click to select FileSaveAs.</li> Change the Macros in box to the template that you want the macro saved to (for example, Normal.dot (global template)), and then click Create.</li>  Change the FileSaveAs macro to the following: Sub FileSaveAs

Dialogs(wdDialogFileSaveAs).Show ActiveDocument.ActiveWindow.Caption = _ ActiveDocument.ActiveWindow.Caption + " - My Caption"

End Sub </li> On the File menu, click Close and Return to Microsoft Word.</li> On the Tools menu, click Open and open a Word document. The title bar for the document should now appear similar to the following:

Microsoft Word - MyDocument.doc - My Caption

</li> On the File menu, click Save As, and save your Word document with a different file name.</li></ol>

Result: The Word document title bar is not updated with the saved file name.

<div class="references_section">