How to show the Properties dialog box via VBA

In this article, you will find a VBA macro that opens the Properties dialog box in Word, ready for the user to edit built-in properties or add/edit custom document properties.

If you have searched the Internet for help on displaying the Properties dialog box via VBA, you may have found information telling that this is not possible. However, it is indeed possible as you will learn below.

This article was first published December 31, 2022.

The Properties dialog box

The Properties dialog box lets you edit built-in document properties (Title, Subject, Author, Manager, Company, Category, Keywords, and Comments. Via the Custom tab, you can add/edit custom document properties. The dialog box also lets you view document statistics and more.

The Properties dialog box in Word - learn how to show the Properties dialog box via VBA

Figure 1. The Properties dialog in Word. You can add/edit custom document properties via the Custom tab.

How to display Word's built-in dialog boxes via VBA in general

In general, you can display Word's built-in dialog boxes using the following syntax:

Dialogs(name).Show

Microsoft maintains a list of dialog box names, the WdWordDialog enumeration. You can find the list via the following link: WdWordDialog enumeration (Word). For each dialog box, you find a name, value, and description. Unfortunately and for unknown reasons, the Properties dialog box is missing in the list.

Fortunately, the VBA code for displaying a dialog box accepts the value instead of the name. For example, the Print dialog box has the name wdDialogFilePrint and the value 88. You can display the Print dialog box using any to the two code lines below:

Dialogs(wdDialogFilePrint).Show
Dialogs(88).Show

It is possible to find the proper value to use to show the Properties dialog box. See Below.

VBA code – show the Properties dialog box

As explained above, the Properties dialog box is missing in the WdWordDialog enumeration. Thus, it has no name. However, it has a value that can be used: 750. This means that the code below will show the Properties dialog box:

Dialogs(750).Show

The Properties dialog box will open with the most recently used tab selected. For example, the Custom tab will be selected if you used that tab most recently.

Do you want to work more efficiently with custom document properties in Word?
Learn what the Word add-in DocTools DocPropertyManager can do for you

Adding and editing custom document properties via the built-in Properties dialog box is not efficient, especially if you work with many custom document properties. 

My Word add-in DocTools DocPropertyManager lets you work much more efficiently with custom document properties. In addition, the add-in lets you perform many tasks in relation to custom document properties that you cannot perform using Word's built-in features.

The value 750 has been found by creating a macro that lists all dialogs (you will find the macro below).

Macro – create list of all dialog boxes – used to find Properties value 750

You can use the macro below to create a list of all dialog boxes to get the value of the Properties dialog box. See the comments in the macro for details.

If you search for the word "properties" in the resulting list that is generated by the macro, you will find a few instances. The one you need is "FileProperties" – and you will see that it has a value of 750.

You can copy the macro code below and insert it either in your Normal.dotm file or in another macro-enabled Word file of your choice. For help on installing a macro, see How to Install a Macro.

Option Explicit

Sub CreateListOfWordDialogs_ToFindPropertiesDialogBoxValue()
    '=========================
    'Macro created 2022 by Lene Fredborg, DocTools - www.thedoctools.com
    'THIS MACRO IS COPYRIGHT. YOU ARE WELCOME TO USE THE MACRO BUT YOU MUST KEEP THE LINE ABOVE.
    'YOU ARE NOT ALLOWED TO PUBLISH THE MACRO AS YOUR OWN, IN WHOLE OR IN PART.
    '=========================
    'The macro creates a new document and adds a list showing the following for each dialog:
    '- the dialog index number
    '- the value
    '- the command name
    'By checking the resulting list afterwards, you will find that the command
    'FileProperties (the command that opens the Properties dialog box) has the value 750
    '=========================

    Dim oDoc As Document
    Dim oDialog As Dialog
    Dim n As Long
    
    On Error GoTo ErrorHandler
    
    Set oDoc = Documents.Add
    'Set default tab stop
    oDoc.DefaultTabStop = CentimetersToPoints(3)
    
    DoEvents
    
    Application.ScreenUpdating = True
    
    'Iterate to a number higher than the highest expected number
    For n = 1 To 5000
        Set oDialog = Dialogs(n)
        With oDialog
            'CommandBarId is equal to the number in the WdWordDialog enumeration
            'CommandName is NOT equal to the name in the WdWordDialog enumeration
            'Insert #n - CommandBarId - CommandName
            oDoc.Range.InsertAfter _
                n & vbTab & .CommandBarId & vbTab & .CommandName & vbCr
        End With
SkipNumber:
    Next n
    
    With oDoc
        'Turn off spell checking
        .Range.NoProofing = True
        'Insert heading line
        .Range.InsertBefore _
            "Index no." & vbTab & "Value" & vbTab & "Command name" & vbCr
        'Make heading line bold
        .Paragraphs.First.Range.Font.Bold = True
    End With

    Application.ScreenUpdating = True
    Application.ScreenRefresh
    
    MsgBox "Finished creating list of dialog boxes."
    
    Set oDialog = Nothing
    Set oDoc = Nothing
    
    Exit Sub
'=========================
ErrorHandler:
    'Skip all numbers that cause an error
    'since not all numbers are used for dialog boxes
    If Err.Number <> 0 Then
        Resume SkipNumber
    End If
End Sub

How to add the Properties dialog box to the Quick Access Toolbar

If you want to be able to open the Properties dialog box via a button in the Quick Access Toolbar (QAT), you can add the following macro e.g. to Normal.dotm and assign the macro to the QAT.  The line "On Error Resume Next" is included to prevent an error if clicking Cancel in the dialog box.

For help on installing a macro, see How to Install a Macro.

Sub ShowPropertiesDialogBox()
    On Error Resume Next
    Dialogs(750).Show
End Sub

Note that you do not need a macro to add the Properties dialog box to the QAT. You can instead add it via the Options dialog box in Word: Select File > Options > Quick Access Toolbar. In the Choose commands from list, select All commands. In the list of commands, find and select View Document Properties. Click the Add >> button to add it to the QAT (first make sure to select the desired destination in the top-right list). Click OK. See Figure 2 below.

How to add the Properties dialog box to the QAT via the Options dialog box in Word

Figure 2. Select File > Options in Word. Then follow no. 1-4 o add the Properties dialog box to the QAT.

How to open the Properties dialog box manually in Word

To open the Properties dialog box from within Word, select File > Info > Properties > Advanced Properties. See no. 1-3 in the Figure 3 below:

How to open the Properties dialog box from  within word

Figure 3. In Word, select File – then follow no. 1-3 to open the Properties dialog box. By using the macro below, all this is done in one operation.

Related information

For help on installing a macro, see How to Install a Macro.

You will find more details about displaying built-in dialog boxes in Microsoft's article Displaying built-in Word dialog boxes.

You will find additional information in the article Getting help with calling Word's built-in dialogs using VBA (and why doing so can be much more useful than you'd think) on the Word MVP site.

The list of Word dialog box names and values can be found in WdWordDialog enumeration (Word) – but the Properties dialog box is missing in that list, as explained above. The "Description" column in the list shows the arguments you can use with each dialog box (not all the arguments are working, though).

The article Built-in Dialog Box Argument Lists (Word) also shows the command names. The column "Argument lists" includes the same information as the "Description" column in the article above. The list in this article does not include the "Value" column.

Free Trial icon
Word Add-In from DocTools
Did you know that...

DocTools Word Add-Ins
can help you save time in Word

On my website wordaddins.com you will find some of the Word Add-Ins I have developed, ready for use:

Generate complete documents in seconds from re-usable text or graphics - read more...

helps you manage comments in Word fast and easy – auto-number, review, extract comments, etc. - read more...

Makes it easier than ever to work with cross-references in Word documents - read more...

Lets you manage document data efficiently with custom document properties and DocProperty fields - read more...

Lets you extract insertions, deletions and comments in full context and including headings - read more..

Lets you apply or remove any highlight color by the click of a button - read more...

Browse pages, headings, tables, graphic, etc. and find text in Word with a single click - read more...

Browse pages, headings, tables, graphic, etc. and find text in Word with a single click - read more...

Lets you quickly and easily create screen tips in Word with up to 2040 characters - read more...