Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hiding datasource dialog in MS Word MailMerge
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00899134
Message ID:
00900501
Views:
22
A fellow on the MSDN newsgroup told me to add the SQL Select parm in the OpenDataSource method:
oWord.ActiveDocument.MailMerge.OpenDataSource(m.filepath\datafile.xls","ODSO",,,,,,,,,,,[SELECT * FROM `envelopedata$`])
That seemed to do it!

Hope this helps someone else along the way!

Rodd

>I have a program that automates a mailmerge. I have a .doc file created that already has the appropriate text and merge fields as well as a document source pointing to a file in my default install directory. In other words, by default, my program installs in c:\tempapp so the datasource referenced by the .doc file is c:\tempapp\datafile.xls.
>
>However, if someone chooses to install into a directory other than the default, I have to change the data source for the .doc file. I do so with:
>
>
>* m.filepath = install directory
>oWord = createobject("Word.Application")
>oWord.Visible = .T.
>oWord.Documents.Open(m.filepath+"template.doc")
>oWord.ActiveDocument.MailMerge.OpenDataSource(m.filepath+"datafile.xls")
>
>
>The problem is, that this always opens up a Select Table dialog box asking the user to confirm the datasource selection.
>
>Is there any way to keep this dialog from showing up when I "change" the datasource? In this case, the datasource is exactly the same file, just in a different location. I really don't want the user to be confused with the dialog asking about the data source.
>
>Thanks for any help!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform