Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running MSWord from within IE

Status
Not open for further replies.

DavidJA

Programmer
Jan 10, 2002
58
AU
Hey all,

I need to start a copy of MSWord from JavaScript, opening a spacific document.

EG: I need to simulate the following
start winword.exe \\Fileserver2\documents\david\MyDoc.HTM, and have MS word open the document in read-write mode. (the HTM file is obviously not associated with word so simply going window.open('mydoc.doc') will not work.

Can anyone specify how to do this from within JavaScript. (it can be ie spacific).

Thanks!
 
Hi DavidJA,

Would you like to try the following:

Code:
<html>
<body>
<script language=&quot;javascript&quot;>
var objWord = new ActiveXObject(&quot;Word.Application&quot;);
if (objWord != null)
{
	objWord.Documents.open(&quot;\\Fileserver2\documents\david\MyDoc.HTM&quot;);
	objWord.visible = true;
}
</script> 
</body>
</html>

Hope this helps! [smile] mikey2nicey
&quot;Dream, but don't quit your day job.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top