>I posted this earlier...sorry to confuse you. This covers what I captured of what happened in Word...um, what I need to happen in Word.
>
>I recorded the following macro to produce code for what I need to do. I'm opening the data file for a mail merge and receive a couple of prompts along the way I would like to deal with in code. Any help converting the following is greatly appreciated.
>
>ActiveDocument.MailMerge.OpenDataSource Name:= _
>"C:\myfiles\labels.xls", ConfirmConversions:=False, _
>ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
>PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
>WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
>Connection:= _
>"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\newproject\labels.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLE" _
>, SQLStatement:="SELECT * FROM `Sheet1$`", SQLStatement1:="", SubType:= _
>wdMergeSubTypeAccess
>
>Thanks,
>Martha
#define wdMergeSubTypeAccess 1
#define wdOpenFormatAuto 0
lcFile = m.dir+"data\labels.xls"
TEXT TO lcConnection NOSHOW TEXTMERGE PRETEXT 15
Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;
Data Source=<<lcFile>>;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;
"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";
Jet OLEDB:Database Password="""";Jet OLE
ENDTEXT
oWord.ActiveDocument.MailMerge.OpenDataSource(m.lcFile,;
wdOpenFormatAuto,;
.f.,;
.f.,;
.t.,;
.f.,;
"",;
"",;
.f.,;
"",;
"",;
m.lcConnection,;
"SELECT * FROM `Sheet1$`",;
"",;
.f.,;
wdMergeSubTypeAccess)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.