Simon,
I've achieved basically what you want in the following way using WordBasic. It's not without it's problems though - missing foxpro datasource - different Word versions etc. But hope this helps anyway. The letter is mailmerged with a 2.6 compatible dbf and displayed when complete.
*******************
lcFileName = ALLTRIM(gcRootDir) + 'LETTERS\' + ALLTRIM(letters.filename)
IF !FILE(lcFileName)
= MESSAGEBOX('Unable to find selected letter!'+CHR(13)+'Check with your system administrator'+CHR(13)+'for proper installation of letters.',0+16+0,'Unable to Find Letter')
RETURN .F.
ENDIF
WAIT WINDOW "Processing..." NOWAIT
thisform.oWordDoc = CREATEOBJECT("Word.Basic")
IF TYPE('thisform.oWordDoc')<>'O' OR ISNULL(thisform.oWordDoc)
= MESSAGEBOX('Unable to open Word. Check to make sure'+CHR(13)+'Word is available on your system and '+CHR(13)+'that you have enough memory.',16,'Merge Aborted')
RETURN .F.
ENDIF
thisform.oWordDoc.FileOpen(lcFileName)
lcDSNString = "DSN=FoxPro Files;DBQ="+gcRootDir+";DefaultDir="+gcRootDir+";DriverId=536;UID=admin;"
lcDataSource = gcRootDir+"merge.dbf"
thisform.oWordDoc.MailMergeOpenDataSource(lcDataSource, , ,1, , , , , , ,lcDSNString,"SELECT * FROM merge.dbf")
thisform.addhiddenfield()
* do merge
thisform.oWordDoc.MailMerge(1,0,1, , , ,1)
thisform.oWordDoc.AppShow()
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only