Something like:
with oWord.ActiveDocument.MailMerge
.OpenDataSource(;
"C:\iftp_log_viewonly.txt",,,,,,,,,,,;
"DSN=Text Files;DBQ=C:\;DefaultDir=C:\;DriverId=27;MaxBufferSize=2048;PageTimeout=5;"+;
'SQLStatement:="SELECT * FROM iftp_log_viewonly.txt"')
.....
There are plenty of parameters that you may omit (as above) because they have default values. Also to see exactly connection string, you could record a macro in Word and then use the code with manor modification in VFP.
>Hi Yuri,
>
>I am opening a mail merge word document, the text file is the record source I am trying to pass in to the word document.
>
>Thanks
>Mark
>
>
>>Mark,
>>
>>What do you mean, 'recordsource for a word document'?
>>Is /oWord.Selection.InsertFile("c:\fileName.txt")/ not what you need?
>>Or you need to open txt file from Word like oWord.documents.open(file_name) ?
>>
>>
>>
>>>Hi Yuri,
>>>
>>>Thanks for your reply, what I am actually trying to do is pass in a text file as a recordsource for a word document. Do you know the command to do this??
>>>
>>>Thanks again
>>>Mark
>>>
>>>
>>>
>>>>>Hi All,
>>>>>
>>>>>I am wondering if anyone can help.
>>>>>
>>>>>I have a mail merge word template into which I want to pass in a text file automatically from foxpro.
>>>>>
>>>>>Does anyone know how I can do this through Foxpro, bascially I have the text file in a variable and I want to invoke a word template that will look at my text file.
>>>>>
>>>>>Cheers
>>>>>Mark
>>>>
>>>>Something like:
>>>>oWord = CREATEOBJECT("Word.Application")
>>>>oWord.documents.open(template_name)
>>>>lc="YOUR TEXT go here"
>>>>oWord.activedocument.content.insertafter(lc)
>>>>*or if you want to insert txt file:
>>>>oWord.Selection.InsertFile("c:\fileName.txt")
>>>>.............
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only