ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening a Word Doc (https://www.excelbanter.com/excel-programming/416636-opening-word-doc.html)

Little Penny[_3_]

Opening a Word Doc
 
I have a MS Word document that is merged with and excel spread sheet.
When I open the word doc (double click) I get the following message:

Opening this document will run the following SQL command

SELECT*FROM 'Data$'

Data from your database will be placed in the document Do you want to
continue y or n

Which is what I want.


But if I use a macro from Excel to open the Word doc


oWord.Documents.Open "C:\test\DataDoc.doc"


It does not run the SQL command.


Am I doing something wrong?



Thanks



Little Penny

Gary''s Student

Opening a Word Doc
 
See if:

ActiveWorkbook.FollowHyperlink Address:="C:\test\DataDoc.doc"
or
x = Shell("cmd.exe /c C:\test\DataDoc.doc", 1)

behave any better.
--
Gary''s Student - gsnu2007k


"Little Penny" wrote:

I have a MS Word document that is merged with and excel spread sheet.
When I open the word doc (double click) I get the following message:

Opening this document will run the following SQL command

SELECT*FROM 'Data$'

Data from your database will be placed in the document Do you want to
continue y or n

Which is what I want.


But if I use a macro from Excel to open the Word doc


oWord.Documents.Open "C:\test\DataDoc.doc"


It does not run the SQL command.


Am I doing something wrong?



Thanks



Little Penny


Little Penny[_3_]

Opening a Word Doc
 
On Sat, 6 Sep 2008 06:53:01 -0700, Gary''s Student
wrote:


Worked great....


Thanks




See if:

ActiveWorkbook.FollowHyperlink Address:="C:\test\DataDoc.doc"
or
x = Shell("cmd.exe /c C:\test\DataDoc.doc", 1)

behave any better.



All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com