I am developing a VB6 COM add-in for Microsoft Word and I have added a button to the Ribbon which will save the document to a database. But before the document is saved, I want to take the user to the document properties window so they can fill in the properties for the document (like Tit开发者_如何学Pythonle, Subject and Author). I am using the following statement to bring up the window:
Application.Dialogs(750).Display
This works fine, but it defaults to showing them the General tab. The fields for Title, Subject and Author) are on the Summary tab. Is there any way to bring up this dialog box and force it over to the Summary tab? I thought about sending keystrokes, but the tabs don't have hotkeys associated with them.
I need this to work in Word 2007 and Word 2010. The line above already works fine in Word 2003 because 2003 doesn't have a multi-tabbed properties window.
You can bring up a seperate box for this (works in both Word 2000, 2003, 2007 and 2010):
Application.Dialogs(wdDialogFileSummaryInfo).Display
or
Application.Dialogs(86).Display
You can also program against this dialog. See here for an example.
You could record a macro then execute it as needed.
Changing .Display to .Show works, except you get an error if you press ESC, so you have to wrap it in On Error Resume Next (no idea why).
Sub CustomProperties()
On Error Resume Next
Application.Dialogs(750).Show
End Sub
精彩评论