Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP Mail Merge using Word Document
Message
De
03/12/1998 10:13:46
Bob Macwilliam
Euphoria Media Solutions
Toronto, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00163580
Message ID:
00163630
Vues:
29
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()
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform