C
cterryo
I posted a thread earlier and need to update it as there have been additional
details that change the question. Earlier thread questioned use of equal
sign and not equal sign. Update is: that is not where the error is.
The following macro runs:
ChangeFileOpenDirectory "M:\My Documents\"
Documents.Open FileName:="ENGP.DOC", ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM MAIL.DBF WHERE ((`STATUS` = 'PP') AND (`RACE` <>
'M'))" _
& ""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
This one does not - error message says "run time error 4606, This method or
property is not available because current mail merge main document needs data
source"
ChangeFileOpenDirectory "M:\My Documents\"
Documents.Open FileName:="ENGL1.DOC", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM MAIL.DBF WHERE ((`STATUS` = 'L1') AND (`RACE` <>
'M'))" & _
""
With ActiveDocument.MailMerge ***(it bombs at this point)***
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
details that change the question. Earlier thread questioned use of equal
sign and not equal sign. Update is: that is not where the error is.
The following macro runs:
ChangeFileOpenDirectory "M:\My Documents\"
Documents.Open FileName:="ENGP.DOC", ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM MAIL.DBF WHERE ((`STATUS` = 'PP') AND (`RACE` <>
'M'))" _
& ""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
This one does not - error message says "run time error 4606, This method or
property is not available because current mail merge main document needs data
source"
ChangeFileOpenDirectory "M:\My Documents\"
Documents.Open FileName:="ENGL1.DOC", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM MAIL.DBF WHERE ((`STATUS` = 'L1') AND (`RACE` <>
'M'))" & _
""
With ActiveDocument.MailMerge ***(it bombs at this point)***
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With