在 Word 中,以编程方式打开新文档对话框
我正在寻找一种在 Word 2007 中以编程方式打开“新建文档”对话框的方法。它与选择 File->New 时得到的对话框相同。您还可以使用 FileNew 宏或“新建...”菜单命令打开它。但是,我一直无法找到一种以编程方式执行此操作的方法。
我已经尝试过:
Application.Run MacroName:="FileNew"
and
Dialogs(wdDialogFileNew).Show
and
CommandBars.FindControl(ID:=5746).Execute
但这两者都会打开旧对话框,而不是 word 2007 使用的新对话框。
I am looking for a way to programatically open the "New Document" dialog in Word 2007. It is the same one you get when you select File->New . You can also open it using the FileNew macro or the "New..." menu command. However, I have been unable to find a way to do this programmatically.
I have tried:
Application.Run MacroName:="FileNew"
and
Dialogs(wdDialogFileNew).Show
and
CommandBars.FindControl(ID:=5746).Execute
but both of these open the old dialog, not the new one that word 2007 uses.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果存在用于打开该对话框的“真实”VBA 命令,我找不到它。然而,我确实通过一些快速谷歌搜索发现了这个完全蹩脚的解决方法:
它确实可以满足你的要求!在这里找到它 http://www .eggheadcafe.com/software/aspnet/32228837/new-file-dialog-in-word-2.aspx
If a 'real' VBA command exists for open that dialog, I can't find it. However, I did find this utterly lame workaround via some quick googling:
It does what you want though! Found it here http://www.eggheadcafe.com/software/aspnet/32228837/new-file-dialog-in-word-2.aspx
您可以获取按钮的命令 ID 并执行它吗?
控件 ID 18 是“新建...”按钮的字应用程序 ID。
You could get the Command ID for the button and execute it?
Control ID 18 is the word application ID for the New... button.
我认为你可以只使用:
不带任何参数。
I think that you can just use:
without any parameters.