简体   繁体   English

用书签更新Word模板

[英]Updating Word Template with bookmarks

I have Template made in Word 2003 which is sometimes updated (adding text, bookmarks, formfields ...) and its located on intranet and has the same name all the time (for example "Master_layout.dot"). 我有Word 2003中制作的模板,该模板有时会进行更新(添加文本,书签,表单域...),并且它位于Intranet上,并且始终具有相同的名称(例如“ Master_layout.dot”)。 When somebody create the document from this template (for example version 3) and then I will make version 4 then the document made from version 3 is not updated and it does not include the changes which I made. 当有人从该模板创建文档(例如版本3),然后我将创建版本4时,则不会更新从版本3生成的文档,并且其中不包含我所做的更改。 I would like to use some VBA script which will check if the Template has the same content (formfields, bookmarks, text...) like the document and if not then add the text, formfield and so on into the document. 我想使用一些VBA脚本,该脚本将检查模板是否具有与文档相同的内容(表单域,书签,文本...),如果不相同,则将文本,表单域等添加到文档中。

Thanks for any help or tip. 感谢您的帮助或提示。

Rather than checking that the content is the same, you might want to consider using a custom property on the template to store the version number. 您可能要考虑使用模板上的自定义属性来存储版本号,而不是检查内容是否相同。 Then you can just check the version. 然后,您可以检查版本。

Sub CheckVersion()

    If ActiveDocument.CustomDocumentProperties("VersionNum").Value <> 4 Then
        'do stuff'
    End If

End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM