F
fai
Dear all:
I have a problem in calling MailMerge function in macro with following
coding.
It's failed at word.mailmerge statement with
"run time error 4198 Application-defined or object-defined error"
Can any expert help to resolve
curdirectory = "F:\Project"
'fileName = curdirectory + "\sample.doc"
fileName = curdirectory + "\Model.doc"
fileNam2 = curdirectory + "\Model_eCert_PassdLabel.doc"
filedatasource = curdirectory + "\Fai_Temp_CARD.XLS"
Set wordDoc = GetObject(fileName, "word.document")
wordDoc.Application.Visible = True
wordDoc.MailMerge.MainDocumentType = wdFormLetters
With wordDoc.MailMerge
.OpenDataSource Name:=filedatasource, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True,
_
AddToRecentFiles:=False, PasswordDocument:="123456",
PasswordTemplate:="", _
WritePasswordDocument:="123456", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, _
Connection:="Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=Admin;Data Source=" + filedatasource + ";Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB
ata" _
, SQLStatement:="SELECT * FROM `Working$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
End With
wordDoc.MailMerge.Execute Pause:=True
I have a problem in calling MailMerge function in macro with following
coding.
It's failed at word.mailmerge statement with
"run time error 4198 Application-defined or object-defined error"
Can any expert help to resolve
curdirectory = "F:\Project"
'fileName = curdirectory + "\sample.doc"
fileName = curdirectory + "\Model.doc"
fileNam2 = curdirectory + "\Model_eCert_PassdLabel.doc"
filedatasource = curdirectory + "\Fai_Temp_CARD.XLS"
Set wordDoc = GetObject(fileName, "word.document")
wordDoc.Application.Visible = True
wordDoc.MailMerge.MainDocumentType = wdFormLetters
With wordDoc.MailMerge
.OpenDataSource Name:=filedatasource, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True,
_
AddToRecentFiles:=False, PasswordDocument:="123456",
PasswordTemplate:="", _
WritePasswordDocument:="123456", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, _
Connection:="Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=Admin;Data Source=" + filedatasource + ";Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB
, SQLStatement:="SELECT * FROM `Working$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
End With
wordDoc.MailMerge.Execute Pause:=True