问题描述
你好,
我目前正在尝试从excel电子表格创建一个mailmerge。
电子表格的所有名字都是一个人我只需要第一个名字。
我试图使用自定义SELECT语句编辑mailmerge的ActiveDocument.MailMerge.DataSource.QueryString属性:
ActiveDocument.MailMerge.DataSource.QueryString =" SELECT Name,Address,City,LEFT(Firstnames,INSTR(1,Firstnames,'') - 1)AS Firstnames FROM [Tab1 $]"
但似乎单词不喜欢查询,因为它返回错误4198'执行失败'执行此行。
我不知道我使用的SQL函数是否正确,甚至是否可以编辑Select语句中的字段...
有什么想法吗?
Hello,
I am currently trying to create a mailmerge from an excel spreadsheet.
The spreadsheet is given with all firstnames of a person while I only need the first firstname.
I've tried to edit the ActiveDocument.MailMerge.DataSource.QueryString property of the mailmerge with a custom SELECT statement :
ActiveDocument.MailMerge.DataSource.QueryString = "SELECT Name, Address, City, LEFT(Firstnames, INSTR(1, Firstnames, ' ') - 1) AS Firstnames FROM [Tab1$]"
However it seems like word doesn't like the query as it returns an error 4198 'Execution has failed' upon the execution of this very line.
I don't know if the SQL functions I am using are right nor if it is even possible to edit the fields in the Select statement...
Any idea?
这篇关于Word 2013 Mailmerge - 从excel编辑mailmerge的select语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!