Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running a mailmerge with Word
Message
From
24/09/2007 16:35:01
 
 
To
24/09/2007 16:11:05
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01256357
Message ID:
01256476
Views:
17
>2003
>
>>What version of Office?

I'm really not sure, because I don't have MS Office installed on my hom ecomputer (They don't like a computer with TS installed)
I always use a native Word docs for our MailMerge routine. But maybe you need this:
(no error handling here)
strConnection = [Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;DefaultDir=c:\mypath;]

oWord.Documents.Open([......])

WITH oWord.ActiveDocument.MailMerge
     .MailMerge.OpenDataSource([c:\bla bla\MyFile.XLS],,,.t.,.t.,,,,,,,strConnection, "SELECT * FROM [sheet1$]")
     .Destination        = 0           && File
     WITH .DataSource
          .FirstRecord = 1
          .LastRecord  = 20 && ?????????????????
        ENDWITH
        .Execute(.t.)
   ENDWITH
As I said this is only on top of my head. I just check the syntax with MSDN but I am not sure at all that this would work.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform