Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Mail Merge
Message
 
To
23/04/2012 03:14:23
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows 7
Miscellaneous
Thread ID:
01542272
Message ID:
01542330
Views:
37
>I posted this earlier...sorry to confuse you. This covers what I captured of what happened in Word...um, what I need to happen in Word.
>
>I recorded the following macro to produce code for what I need to do. I'm opening the data file for a mail merge and receive a couple of prompts along the way I would like to deal with in code. Any help converting the following is greatly appreciated.
>
>ActiveDocument.MailMerge.OpenDataSource Name:= _
>"C:\myfiles\labels.xls", ConfirmConversions:=False, _
>ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
>PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
>WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
>Connection:= _
>"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\newproject\labels.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLE" _
>, SQLStatement:="SELECT * FROM `Sheet1$`", SQLStatement1:="", SubType:= _
>wdMergeSubTypeAccess
>
>Thanks,
>Martha
#define wdMergeSubTypeAccess 1
#define wdOpenFormatAuto     0

lcFile = m.dir+"data\labels.xls"

TEXT TO lcConnection NOSHOW TEXTMERGE PRETEXT 15
     Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;
     Data Source=<<lcFile>>;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;
     "";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";
     Jet OLEDB:Database Password="""";Jet OLE
ENDTEXT


oWord.ActiveDocument.MailMerge.OpenDataSource(m.lcFile,;                && Name
                                             wdOpenFormatAuto,;         && Format
                                             .f.,;                      && ConfirmConversions
                                             .f.,;                      && ReadOnly
                                             .t.,;                      && LinkToSource
                                             .f.,;                      && AddToRecentFiles
                                             "",;                       && PasswordDocument
                                             "",;                       && PasswordTemplate
                                             .f.,;                      && Revert
                                             "",;                       && WritePasswordDocument
                                             "",;                       && WritePasswordTemplate
                                             m.lcConnection,;           && Connection
                                             "SELECT * FROM `Sheet1$`",; &&SQLStatement
                                              "",;                       &&SQLStatement1
                                              .f.,;                      && OpenExclusive
                                               wdMergeSubTypeAccess)     && SubType
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform