Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with Automating MailMerge Setup
Message
De
14/10/1999 16:02:24
Becky Vidal
Heritage Information Systems, Inc.
Richmond, Virginie, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Problem with Automating MailMerge Setup
Divers
Thread ID:
00276530
Message ID:
00276530
Vues:
67
I have a program (listed below) which creates a Word object, opens a document and adds a data source for a mail merge. When I run a macro in Word which does the same thing it works fine. But when I run my program, it sets up the mailmerge OK but displays a "Confirm Data Source" Screen, where it waits for me to select the FoxPro Files - Word" option. I don't understand why it works fine as a macro in word, but not when ran in VFP. I created the VFP code from the macro.destdir = "Q:\appsdev\vers2.0\graphletter\data\00004459"

** Program
m.letter = "H2RA_TI_LETTER_OPTION1.DOC"
m.mletter = "lMMERGE.DBF"

newLetter = destdir + "\" + m.letter
newMerge = destdir + "\" + m.mletter

x1 = CREATEOBJECT("Word.Application")
x1.Documents.Open(newLetter)
x1.Visible = .T.

x1.ActiveDocument.MailMerge.MainDocumentType = -1
x1.ActiveDocument.MailMerge.MainDocumentType = 0

connStr = "DSN=FoxPro Files - Word;UID=;PWD=;SourceDB=" + destdir + ";SourceType=DBF;Exclusive=No;" + ;
"BackgroundFetch=Yes;Collate=MACHINE;Null=Yes;Deleted=Yes;"

** OPen DataSource format (name, format, ConfirmConversions, **ReadOnly, LinkToSource, AddToRecentFiles,
** PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, **WritePasswordTemplate, Connection
x1.ActiveDocument.MailMerge.OpenDataSource(newMerge,0,0,0,1,0, , , , connStr)
x1.ActiveDocument.MailMerge.EditMainDocument

x1.ActiveDocument.Save
x1.ActiveDocument.Close
x1.Quit


Thanks
Becky
Répondre
Fil
Voir

Click here to load this message in the networking platform