>Kevin,
>.insertdatabase(..) is the ODBC connection code. In word opening a new doc or changing active doc switches to another window. Have you looked or run the code ? If not run yet create the template c:\temp\prttest.doc (or change name to whatever you want in code also). Changing the link to source parameter to 1 would also link it to FoxData (here embedded).
>Cetin
>
Cetin,
I think I understand what you are doing but when I try to run the following code I get a mismatch error.
oword = createobject("word.basic")
oword.appshow && Show Word App - Word 7.0 Support
oword.filenewdefault && New file, default template - Will create datasource
cDSN = "DSN=Visual FoxPro Tables;UID=;PWD=;"
cSourceDb = "SourceDB=C:\AMM\TEM12.DBF"
cSourceType = ";SourceType=DBC;"
cOther = "Exclusive=No;BackgroundFetch=No;Collate=Machine;"
* Insertdatabase parms build here for clarifying
* 35,511 are autoformatting options for grid - ignore
* 0 Link to source false
** The following line gives me the mismatch error
oword.InsertDatabase(35,511,0,cDSN+cSourceDb+cSourceType+cOther,,,,,,,,,1)
oword.filesaveas("c:\temp\xxmmergedoc",0) && Save as a word doc for mailmerge
oword.fileclose(1) && Close saving
* Datasource ready, now create mailmerge main document
Any ideas?