如何以编程方式在 Word 中调出文档属性窗口并转到“摘要”选项卡?

发布于 2024-09-10 18:59:25 字数 462 浏览 1 评论 0原文

我正在为 Microsoft Word 开发一个 VB6 COM 插件,并且在功能区中添加了一个按钮,用于将文档保存到数据库中。但在保存文档之前,我想将用户带到文档属性窗口,以便他们可以填写文档的属性(例如 TitleSubject>作者)。我使用以下语句来打开窗口:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

二智少女 2024-09-17 18:59:25

您可以为此打开一个单独的框(适用于 Word 2000、2003、2007 和 2010):

Application.Dialogs(wdDialogFileSummaryInfo).Display

或者

Application.Dialogs(86).Display

您也可以针对此对话框进行编程。有关示例,请参阅此处

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.

浅唱々樱花落 2024-09-17 18:59:25

您可以录制一个宏,然后根据需要执行它。

You could record a macro then execute it as needed.

唔猫 2024-09-17 18:59:25

将 .Display 更改为 .Show 是有效的,但如果按 ESC 会出现错误,因此您必须将其包装在 On Error Resume Next 中(不知道为什么)。

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文