I just tried the same process but this time the datasource was a fox table.
Opening the word doc from explorer has the datasource attached ( If I answer yes to the prompt) But opening the very same doc from VFP always has the datasource detached.
I just found if I add this line:
oword.Application.DisplayAlerts = -1
I then get the question to run the SQL statement.
and lo and behold the datasource is attached.
Searching the internet for "run the following sql command" I found this issue is a known "bug"/security feature in Word 2003 and Word 2002 SP3. I have Word 2002 so I changed 11.0 to 10.0 and the fix now works.
The fix
Open Registry Editor.
Start/Run/Regedit
Locate, and then click the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options
Click Edit, point to New, and then click DWORD Value.
Under Name, type:
SQLSecurityCheck
Double-click SQLSecurityCheck.
In the Value data box, type:
00000000
Click OK.
http://support.microsoft.com/default.aspx?scid=KB;EN-US;825765Seems weird nobody had a problem with your download ( thanks for the code though! ) I guess most programmers are still running with MS Word 97,ha ha
Thanks for your help...