[英]How to merge a remote MS Word document with the active document in a VBA macro?
In the "frontend" I have a macro linked to a button in my command bar within Word. 在“前端”中,我有一个宏链接到Word中命令栏中的按钮。 Purpose of this button is to allow users to compare the current document with its previous version. 此按钮的目的是允许用户将当前文档与其以前的版本进行比较。
In the backend I have a Java EE server and Alfresco running with a few servlets. 在后端,我有一个Java EE服务器和运行有一些servlet的Alfresco。 One of these servlets currently returns .doc document when given the document's name. 给定文档名称后,这些servlet之一当前会返回.doc文档。 So I just need to call it with the good name containing the version I want and it returns me the document I asked for. 因此,我只需要使用包含我想要的版本的好名字来调用它,它就会向我返回我所需要的文档。
So the ideal workflow for a user would be the following : 因此,对于用户而言,理想的工作流程如下:
The challenging part for me is the one regarding VB6. 对我来说最具挑战性的部分是有关VB6的部分。 I know that I can merge docs with ActiveDocument.Merge FileName:="path_to_file", MergeTarget:=wdMergeTargetSelected
but 我知道可以将文档与ActiveDocument.Merge FileName:="path_to_file", MergeTarget:=wdMergeTargetSelected
但是
Thank you for you help. 谢谢你的帮助。
You open a document using Documents.Open
. 您使用Documents.Open
打开Documents.Open
。 See F1-help for help on the different options and paramteters. 有关不同选项和参数的帮助,请参阅F1帮助。
Option Explicit
Sub OpenDoc()
Dim oDoc As Document
Set oDoc = Documents.Open(FileName:="FILENAME.docx")
Call oDoc.Merge("PATH-TO-OTHER-DOCUMENT.docx")
Set oDoc = Nothing
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.