如何在同一Word窗口中加载另一个新的Word文档? [英] How can I load another new Word document in the same Word window?

查看:102
本文介绍了如何在同一Word窗口中加载另一个新的Word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎在Microsoft Word对象模型中,Word文档绑定到Window,但是我想关闭现有文档并打开一个新文档而不关闭Word窗口.我该怎么办?

It seems that in the Microsoft Word object model, a Word document is bound to a Window, but I want to close the existing document and open a new one without closing the Word window. How can I do this?

推荐答案

这适用于我关闭文档并在同一窗口中打开文档(我从 normal.dotm 运行宏>):

This works for me to close a document and open a document in the same window (I'm running the macro from normal.dotm):

Sub CloseOpenSameWindow()
    Dim d As Document: Set d = ActiveDocument
    Application.ScreenUpdating = False
    d.Close
    Application.Documents.Add Template:="C:\Users\Me\Desktop\Mydocument.docx"
    Application.ScreenUpdating = True
End Sub

这篇关于如何在同一Word窗口中加载另一个新的Word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆