Written by Allen Wyatt (last updated December 16, 2022)
This tip applies to Word 2007, 2010, and 2013
Bill wonders how he can get the Properties dialog box for a document to display from within a macro. In Word 2003 he can do this manually by choosing Properties from the File menu, but the process is a bit more complex in Word 2007 with the need to display the Document Information Panel and then displaying the advanced properties.
Even though the way that you display the Properties dialog box is different in Word 2007 than it is in earlier versions of the program, the way you do it in a macro is not different. You can display a Word dialog box in VBA by using this syntax:
Dialogs(name).Show
This works because VBA makes accessible dialog boxes through the Dialogs collection. The trick is to determine what you should use in the place of name in the syntax. For instance, if you wanted to display the Open dialog box, you could use the following:
Dialogs(wdDialogFileOpen).Show
You can find a complete list of dialog box constants at this site:
http://msdn.microsoft.com/en-us/library/bb214033.aspx
Unfortunately, there is no "wdDialogFileProperties" constant that you can use with the Dialogs collection. This means that the full Properties dialog box cannot be displayed. You can, however, display "pieces" of the dialog box. For instance, you could use the following to display the information found on the Summary tab of the Properties dialog box:
Dialogs(wdDialogFileSummaryInfo).Show
This will work in any version of Word, including Word 2007. If you want to display the Document Information Panel, which is new to Word 2007, then you do so not by using the Dialogs collection, but by using the following code:
Application.DisplayDocumentInformationPanel = True
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (7482) applies to Microsoft Word 2007, 2010, and 2013.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!
Sometimes it is helpful to know how often a particular phrase appears within a document. If you need to know such a ...
Discover MoreNeed to process a document, paragraph by paragraph, in a macro? It's easy to do once you understand that Word's object ...
Discover MoreWhen using a macro to process a document in some way, you often need to know the number of paragraphs in the document. ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-04-11 05:21:49
Lene Fredborg
It is possible to open the Properties dialog box via VBA even if Microsoft has not provided a constant for the dialog box. See my article "How to show the Properties dialog box via VBA": https://www.thedoctools.com/word-macros-tips/word-macros/show-properties-dialog-via-vba/.
2019-03-28 14:08:35
Neman Syed
Thanks for your tip Allen. It's a pity something so important - metadata location - is buried enough to make it daunting for a user. I'm currently designing a template and looking for an easy way to have the users maintain custom document properties. I didn't want to use a macro, but may have to, as it's been difficult to find the corresponding toolbar button.
The Document Information Panel has been removed as of Office 2016 as per https://support.office.com/en-gb/article/where-is-the-document-information-panel-in-office-2016-767bbbbb-27aa-42e8-81dc-9ed5cf06e6e0. Your readers may need to take action accordingly.
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments