如何使用 VB 在实时 Word 文档中多次插入 SQL Server 结果
好吧,我一直在尝试弄清楚如何进行邮件合并、使用该信息进行 MS SQL 调用以及如何将字符串返回到 Word 文档中。 我猜是VB,但我没有VB经验。
Ok, I'm stuck trying to figure out how to take a mail merge, use that info to make MS SQL calls and get strings back in a word document. I'm guessing VB but I have no VB experience.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想使用 SQL Server 中的数据进行邮件合并(无论如何在 Word 2003 中),邮件合并向导的第 3 步中有一个选项:
使用现有列表 > 邮件合并。 浏览> 新的 SQL Server 连接
如果您想从其他数据源获取邮件合并的结果,然后使用这些结果查询 SQL Server,那么您将需要 VBA。 除了弄清楚如何操作 Word 对象模型中的数据之外,您还需要类似 ActiveX 数据对象 (ADO) 用于数据库查询
If you want do a mail merge using data from SQL Server then (in Word 2003 anyway) there's an option on step 3 of the mail merge wizard:
Use an existing list > Browse > New SQL Server connection
If you want to take the results of a mail merge from some other data source and then query SQL Server with those results then you're going to need VBA. As well as working out how to manipulate data in the Word object model, you're going to need something like ActiveX Data Objects (ADO) for the database queries