Code opens up a word document with an excel merge file... (Office 97 or 2000)
#Define DWORD_DOCUMENT sys(5)+ curdir()+ allt(THIS.DOCUMENT_FILE_NAME)
#Define DEXCEL_DOCUMENT sys(5)+ curdir()+ allt(THIS.EXCEL_FILE_NAME)
odoc=.null.
odoc=crea('word.document')
*--- is this a new docoment
If !file(DWORD_DOCUMENT)
If !FILE('MERGET.DOT')
=MESSAGEBOX('Required Merge File Not Found - Call ',16,'SYSTEM MESSAGE')
odoc=.NULL.
Return
Else
JLINE='COPY FILE MERGET.DOT TO '+ DWORD_DOCUMENT
&JLINE
Endif
Endif
odoc.application.documents.open(DWORD_DOCUMENT)
odoc.application.activedocument.mailmerge.opendatasource(DEXCEL_DOCUMENT,.f.,.f.,.t.,.f.,1,'','',1,'','','Entire Spreadsheet')
>Hi Sébastien,
> I am working on a Label/Merge routine in MS Word2000. It is running in
>vfp6.0. I have my data source setup and running and when I run the execute
>command it goes and pops out the labels in a new word document as expected.
>
>But when I run it on another machine I get an Error 1429, the current Mail
>merge Main Document has no merge fields.
>
>Is there a way to programatically to setup the merge fields in the main document before the execute?
>
>I have tried to capture the setup in a word macro, but word does not save
>anything like that.
Thanks,
Stacy
Black Mountain Software, Inc.