How do I reference a particular spreadsheet programatically?

M

Matthew Speed

My code:

filetoopen = Environ("homedrive") & Environ("homepath") &
"\Desktop\qryContractMerge.xls"
Set mymerge = ActiveDocument.MailMerge
With mymerge
.Destination = wdSendToPrinter
.OpenDataSource Name:=filetoopen
.Execute
End With
Application.Quit savechanges:=wdDoNotSaveChanges

When I do this it asks me which table to use, qryContractMerge.xls or
qryContractMerge or qryContractMerge$

How do I tell it which table to use in code instead of having to
select it?
 
Top