Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Mail Merge from 97 to 2002
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Word Mail Merge from 97 to 2002
Divers
Thread ID:
00761181
Message ID:
00761181
Vues:
51
I have a VFP 6 SP3 app that I am testing with XP and Word 2002 SP2. Under ODBC DSN I have VFP Tables and Databases as an option. That does not seem to be the problem. The problem is that the connection between an existing mail merge document and data source seems to be lost. For new documents it works fine. But for existing documents (created in Word 97) I must reestablish the data souce and then save the document for the merge to work. I do not want my clients to have to reestablish the data source on each mail merge document. Any ideas?


goWordApp = createobject("Word.Application")
word_directory = AddBs(JustPath(ctemplate_name)) && returns 'c:\something\somethingelse\'
goWordApp.ChangeFileOpenDirectory (word_directory)

if file(ctemplate_name)
goWordApp.Visible = .T.
goWordApp.documents.open(ctemplate_name)
gowordapp.Application.WindowState = 1
gowordapp.activewindow.windowstate = 3 &&maximized
if creccount != 0
gowordapp.activedocument.mailmerge.destination = 0
goWordApp.ActiveDocument.MailMerge.Execute
endif
else
goWordApp.Visible = .T.
gowordapp.Documents.Add
gowordapp.Application.WindowState = 1
gowordapp.activewindow.windowstate = 1 &&maximized
goWordapp.ActiveDocument.MailMerge.MainDocumentType = 0
goWordapp.ActiveDocument.MailMerge.OpenDataSource(cdatasource)
goWordapp.Activedocument.SaveAs(ctemplate_name)
endif
Répondre
Fil
Voir

Click here to load this message in the networking platform