
Tips.Net > WordTips Home > Macros > Displaying the Document Title Right Away
Summary: One of the properties that Word maintains for a document is a title. If you want this title displayed on the title bar right after opening the document, you’ll need the single-line macro described in this tip. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
Warren is using Word 2003 and needs a way to show the document title (from the document properties) in the title bar of the document window when he first opens the document. Currently, only the filename shows when he first opens the document. The document title shows only after the first time he saves the document.
Actually there is a way to do this, and it will work in Word 97 through Word 2003. All you need to do is add a macro that runs automatically when the document opens. You do this by opening the Visual Basic Editor (Alt+F11) and using the Project Explorer (top-left portion of the Visual Basic Editor) to open the code window for the ThisDocument object for your document. Then, put this macro in the code window:
Private Sub Document_Open()
Application.Caption = _
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)
End Sub
The macro executes when the document is opened. It grabs the document title (from the properties for the document) and stuffs it into the caption for the program (the title bar).
Tip #3422 applies to Microsoft Word versions: 97 2000 2002 2003
Great Idea! Word is a tool to get what you really want—printed output. This means you need to make sure that Word works as well as possible with your printer, whether it is sitting on your desk or in a room down the hall.
Check out WordTips: Printing and Printers today!
Thousands of WordTips, available for immediate download. Have all the Microsoft Word info you need, right at your fingertips. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips