更好的方法来做MailMerge模板 [英] Better Way to do MailMerge templates

查看:416
本文介绍了更好的方法来做MailMerge模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有十几个word文档用作mailmerge模板。每个都有VBA代码分配给快捷键组合。用户打开所需文档并单击Ctrl + Shift + M,代码将查询数据库并填充新文档。
完成。每个文档的代码都相同。我需要做的就是设置一个新文件,在文档中键入标签,将我的代码粘贴到其中然后去。 

I have about a dozen word documents that I use as mailmerge templates. Each one has VBA code assigned to a shortcut key combo. The user opens the desired document and clicks Ctrl+Shift+M and the code queries the database and populates the new document. Done. The code is identical for each document. All I have to do to set up a new one is type up the document with the tags in it, paste my code into it and go. 

问题是,我希望有在我完成之前,有几十个。我已经看到了修改代码的方法,使mailmerge进程对用户更直观,但这意味着我必须打开每个文档以插入修改后的代码。所以,现在我已经有10到12个这样的了,我觉得如果每个文档中的代码相同,为什么我不能把它放在一个地方。 

Problem is, I expect to have several dozen of these before I'm done. I already see ways to modify the code to make the mailmerge process more intuitive for the user, but that means I have to open each document to insert the modified code. So NOW, that I have 10-12 of these already, it occurs to me that if the code is identical in each document, why couldn't I just put it in one place. 

好主意,我只是不知道那是怎么回事。我会将代码放在普通本文档表中吗?那又怎样?有没有人做过这样的事情或有什么尝试的想法?

Great idea, I just don't know how that would work. Would I put the code in the Normal This Document sheet? Then what? Has anybody done something like this or have ideas on what to try?

tod

推荐答案

您好,

在我的选项中,我建议您开发Word VSTO应用程序使用C#加载项,您可以在任何文档中使用此加载项,并且所有代码都存储在一个项目中,您可以参考
演练:为Word创建第一个VSTO加载项

In my option, I would suggest you develop Word VSTO application add-ins with C#, you could use this add in in any of document, and all of the code is stored in one project, you could refer Walkthrough: Creating Your First VSTO Add-in for Word.

如果您不熟悉C#,我建议您使用VBA将word文档保存为Word启用宏模板(* .dotm),然后如果您有新的更新代码,您只能修改模板,并在此模板上创建基于
的新文档。

最诚挚的问候,

爱德华


这篇关于更好的方法来做MailMerge模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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