如何以编程方式在 Word 中调出文档属性窗口并转到“摘要”选项卡?
我正在为 Microsoft Word 开发一个 VB6 COM 插件,并且在功能区中添加了一个按钮,用于将文档保存到数据库中。但在保存文档之前,我想将用户带到文档属性窗口,以便他们可以填写文档的属性(例如 Title、Subject 和 >作者)。我使用以下语句来打开窗口:
Application.Dialogs(750).Display
这工作正常,但默认显示“常规”选项卡。 标题、主题和作者字段位于“摘要”选项卡上。有什么方法可以调出此对话框并将其强制转到Summary选项卡吗?我考虑过发送击键,但选项卡没有与之关联的热键。
我需要它在 Word 2007 和 Word 2010 中工作。上面的行在 Word 2003 中已经可以正常工作,因为 2003 没有多选项卡属性窗口。
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 Title, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以为此打开一个单独的框(适用于 Word 2000、2003、2007 和 2010):
或者
您也可以针对此对话框进行编程。有关示例,请参阅此处。
You can bring up a seperate box for this (works in both Word 2000, 2003, 2007 and 2010):
or
You can also program against this dialog. See here for an example.
您可以录制一个宏,然后根据需要执行它。
You could record a macro then execute it as needed.
将 .Display 更改为 .Show 是有效的,但如果按 ESC 会出现错误,因此您必须将其包装在 On Error Resume Next 中(不知道为什么)。
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).