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!

MS Word Document

Status
Not open for further replies.

DirtyB

Programmer
Mar 13, 2001
159
US
I need to make links to Word documents via the web. In Netscape everything works fine. IE actually opens up the Word file WITHIN the browser. I need it to actually open up WORD on the CLients machine like Netscape does. Anyone know how to do this?

I tried links to ways

FILE:\\...

They both do the same thing.
 
This works but does come up with a security warning. You may be able to get around this if you are on an intranet...
Code:
<html>
<script language=&quot;javascript&quot;>

 function OpenWordDocJS(sDoc) {

  var oWD = new ActiveXObject(&quot;Word.Application&quot;)
  oWD.Visible = true
  oWD.Documents.Open(sDoc)

 }
</script>
<script language=&quot;vbscript&quot;>

 Sub OpenWordDocVB(sDoc)
	
  Dim oWD: Set oWD = CreateObject(&quot;Word.Application&quot;)
  oWD.Visible = True
  oWD.Documents.Open sDoc

 End Sub

</script>

<body>
<input type=button value=&quot;Test Doc with JS&quot; onClick=&quot;OpenWordDocJS('file://c:/test.doc');&quot;><br>
<input type=button value=&quot;Test Doc with VB&quot; onClick=&quot;OpenWordDocVB('file://c:/test.doc');&quot;><br>
</body>
</html>

Later, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
THANK YOU SOOO MUCH.. Will this solution work with Netscape as well?
 
The javascript version might but you may just want to do a little browser detection an show the url version for NN and the script version for IE. BTW, if you are on an Intranet you could also uncheck the file options for .doc files (Any folder window, Tools, Folder Options, File Types) for &quot;Browse in same window&quot;. A .reg file would work OK here. You simply have to find the key ;-)

Later, Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top