Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word 2003 automation Problem
Message
From
13/05/2004 12:01:31
Scott Butts
Ims Specialty Services
Twin Falls, Idaho, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00902166
Message ID:
00903666
Views:
32
In windows 2000 or XP I think it is in the Administrative tools folder, on 98 I think it is just in the control panels folder. There is a Data Sources icon, click add, pick a driver, give it a name and point to the data. You should alread have a DNS setup for FoxPro file types. As far as installing it with your software, if you are using installshield it is really easy, you just have to pick it from a list. I don't know the exact words, but I beleive the VFP 5 installer has an ODBC data source option. Sorry don't have 5 or 6 installed on this machine.

>Hi Scott
>How do I set up a DSN on a machine ?
>
>Thanks a lot
>Gerard
>
>
>
>>The DSN is setup on the machine under 'Data Source (ODBC)' and gcDataDir is a variable pointing to the data directory. I am sorry, I didn't realize you were not using an ODBC data source.
>>
>>>Hi Scott and thanks for your reply.
>>>
>>>I'm not familiar with VBA as my code is VFP .
>>>
>>>
>>>The DSN line.... Does this depend on anything else set up in your PC ?
>>>The & gcDataDir & ..... is this just a variable which holds directory
>>>
>>>Regards,
>>>
>>>Gerard
>>>
>>>
>>>
>>>>I don't know if this will help, but here goes (I hope I am understading the question correctly). I beleive I had a similar problem. I ended up checking the version for word and using different automation code for the different versions of office. My main reason was to maintance backward compatibility. Most of my automation code is done in VBA, here is the code that I had to use for the call to opendatasource for 2003:
>>>>
>>>> ActiveDocument.MailMerge.OpenDataSource Name:="", _
>>>> Connection:="DSN=FoxPro Files;SourceDB=" & gcDataDir & ";Database='letsflds';uid="";pwd="";", _
>>>> SQLStatement:="SELECT * FROM letsflds", _
>>>> SubType:=wdMergeSubTypeWord2000
>>>>
>>>>There was no refrence to SourceDB in the connection string in the documentation but it seems to be the only way that I could get the mailmerge to change datasource. It seemed once a mailmerge document was created and opend that its datasource could never be changed, it always referred back to the original datasource. Adding SourceDB worked like a charm.
>>>>
>>>>Let me know if this helps... or just addes to the confusion.
>>>>
>>>>>Hi Cetin.
>>>>>
>>>>>I sort of thought your 'Set Flamesuit' was a joke....but you never know !!!
>>>>>
>>>>>I dont have any love for OpenDatSource,but is there another way of driving Word Mailmerge 2003 from VFP without it.
>>>>>
>>>>>Regards,
>>>>>
>>>>>Gerard
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Very sorry to hear that 'set flamesuit' joke caused trouble.
>>>>>>Marcia already pointed out a help and that was what I was trying to say. OpenDataSource is not reliable. I had problems with it since word95. You write the code and expect to work, one day customer phones and tells it's not working! If you want to use OpenDataSource then you should write code that wraps versions from say word97 and up (including Word3000 in future maybe!) IMHO it's an awfull decision of Office team.
>>>>>>PS: Solution suggests use of subtype but there is no subtype parameter for OpenDatasource in documentation nor a single pointer to wdMergeSubTypeWord2000 constant (but the constant exists). Go figure.
>>>>>>And not only ODSO problem I think I couldn't make it to work with OLEDB either.
>>>>>>OTOH if you'd still use OpenDatasource you might OpenDatasource which is another office product (doc, xls, mdb). Writing them first is easy and works in all versions I used (w97,2000,2002).
>>>>>>Cetin
>>>>>>
>>>>>>>Hi Cetin.
>>>>>>>The system is currenlty written to use .OPendataSource and works in Prior versions of Word so I am reluctant to change..however if there is another solution I would change
>>>>>>>
>>>>>>>.....Set Flamesuit on
>>>>>>>I dont understand
>>>>>>>
>>>>>>>
>>>>>>>Regards,
>>>>>>>
>>>>>>>Gerard
>>>>>>>
>>>>>>>>>Hi Deepak.
>>>>>>>>>
>>>>>>>>>Error is: Ole Idispatch exception code 0 from Microsoft Word
>>>>>>>>> Word was unable to open the data source.
>>>>>>>>>
>>>>>>>>>Seems to be coming from code :- ..... Mailmerge.OpendataSource(mySource)
>>>>>>>>>
>>>>>>>>>Regards,
>>>>>>>>>
>>>>>>>>>Gerard
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>can u send the error details.......
>>>>>>>>
>>>>>>>>Gerard,
>>>>>>>>Set flamesuit on
>>>>>>>>I suggest to keep away from OpenDataSource unless the source is an another Office product.
>>>>>>>>Set flamesuit off
>>>>>>>>
>>>>>>>>PS: If I could ever find an OpenDatasource syntax that works in all 200x then I'll post.
>>>>>>>>Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform