M
Mark Eidemiller
My intent is to merge a Word document with an Excel spreadsheet, modifying
the filter parameters on the merge so that it will isolate a select group
from the spreadsheet. Usually it's a snap, but I want to be able to use
InputBox to get the filter parameters.
My problem is, they don't fit in the SELECT statement. Where am I going
wrong?
(FYI, I've edited some of the filenames due to company security)
sARD = InputBox("What is the ARD?", "Specify ARD")
sDate = InputBox("What is the date of the report?", "Specify report date")
Documents.Open FileName:="""<report filename>""", _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False,
_
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
ActiveDocument.MailMerge.DataSource.QueryString = _
(This is the statement giving me problems, with the END and ARD variables.)
"SELECT * FROM <spreadsheet filename> WHERE ((END >= sDate) AND (ARD
= sARD)) ORDER BY ARD, LOCATION, EMPLOYEE_NAME" _
& ""
Any help will be greatly appreciated.
Mark
the filter parameters on the merge so that it will isolate a select group
from the spreadsheet. Usually it's a snap, but I want to be able to use
InputBox to get the filter parameters.
My problem is, they don't fit in the SELECT statement. Where am I going
wrong?
(FYI, I've edited some of the filenames due to company security)
sARD = InputBox("What is the ARD?", "Specify ARD")
sDate = InputBox("What is the date of the report?", "Specify report date")
Documents.Open FileName:="""<report filename>""", _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False,
_
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
ActiveDocument.MailMerge.DataSource.QueryString = _
(This is the statement giving me problems, with the END and ARD variables.)
"SELECT * FROM <spreadsheet filename> WHERE ((END >= sDate) AND (ARD
= sARD)) ORDER BY ARD, LOCATION, EMPLOYEE_NAME" _
& ""
Any help will be greatly appreciated.
Mark