By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,621 Members | 1,856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,621 IT Pros & Developers. It's quick & easy.

Opening Word

P: n/a
I am working on a table of contents page in html for an intranet, i want
to click on links to documents and have them open up in word and not word
in the browser, is there a way to do this.

Jul 23 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
In article <f58738fd3de0dfd477738dca4e229d01
@localhost.talkaboutprogramming.com>, rp*****@nospam.indy.rr.com enlightened
us with...
I am working on a table of contents page in html for an intranet, i want
to click on links to documents and have them open up in word and not word
in the browser, is there a way to do this.


MSIE only? Sure.
(url provided works -- I tested with it; change to your URL)

<script type="text/vbscript">
Set obj = CreateObject("Word.Application")
obj.Visible = true
obj.Documents.Open("http://www.cuhumane.org/CARE/cats101.doc")
</script>

--
--
~kaeli~
No one is listening until you make a mistake.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

P: n/a
I couldn't get it to work, so i guess i dont know where the VB script goes
at in the code.

Jul 23 '05 #3

P: n/a
In article <c135293296d173bac55bc25cee2ba1f7
@localhost.talkaboutprogramming.com>, rp*****@nospam.indy.rr.com enlightened
us with...
I couldn't get it to work,
Did you get an error? If so, what?
Do you have MSIE set to actually tell you about errors? For testing, you
should.
so i guess i dont know where the VB script goes
at in the code.

Depends on your code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>

<body>
<script type="text/vbscript">
Set obj = CreateObject("Word.Application")
obj.Visible = true
obj.Documents.Open("http://www.cuhumane.org/CARE/cats101.doc")
</script>
</body>
</html>

That works on my system.
Does it work on yours?

Note: you may get asked to confirm ActiveX, depending on IE settings.

And you ARE using MSIE as your browser, right? Because only MSIE understands
vbscript.

IF YOU ARE TESTING LOCALLY (on your computer with file->open instead of from
another server) UNDER WINXP SP2, THIS WILL NOT RUN BY DEFAULT.
WinXP SP2 will not allow scripts to run locally unless you putz around with
your security settings.
(of course, you should have gotten the little warning at the top of the page
telling you about it, but you may have disabled that or something)

http://www.phdcc.com/xpsp2.htm

--
--
~kaeli~
Practice safe eating - always use condiments.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

P: n/a
I got it to work after i move the code to my C: drive, but i get an error
of the following if i try running from my network drive.

Error ActiveX component can't creat object 'word.application'

Jul 23 '05 #5

P: n/a
In article <9d6622be3b06ccd66e9f4ed6c57632d1
@localhost.talkaboutprogramming.com>, rp*****@nospam.indy.rr.com enlightened
us with...
I got it to work after i move the code to my C: drive, but i get an error
of the following if i try running from my network drive.

Error ActiveX component can't creat object 'word.application'


Ah, I see.
It's your security settings, I think.
Making sure you're not online anywhere else, lower your IE settings to Low
for all the zones (one at a time, then put back to where it was) to see which
zone your PC thinks this is running from. (probably intranet zone) Each time
you lower it for a zone, check and see if it works.

Did it work?
Note that your users may also have problems with this (I usually use this
sort of thing in an HTA, which has special permissions).
Check into signing it.

If you have problems, your users may just need to tweak their browsers to
open the documents independently instead of in the browsers themselves (where
they open is a setting).

To have an individual person tweak how their PC handles Word docs, see this
link:
http://blogs.msdn.com/gusperez/archi...28/122768.aspx

--
--
~kaeli~
If it's tourist season, why can't we shoot them?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6

P: n/a
Secuirty in the intranet zone was the problem.
Thanks for all of your help.

Jul 23 '05 #7

P: n/a
I am wondering if there is a way to pass the filename to the btn1 on-click
sub so it can be reused.

<HEAD>

<script type="text/vbscript">
Dim objWord
Sub Btn1_onclick()
call OpenDoc("K:\Deloitte\Team1 Status report\JavaPrograms\hi.txt")
End Sub

Sub OpenDoc(strLocation)

Set objWord = CreateObject("Word.Application")
objWord.Visible = true
objWord.Documents.Open strLocation
End Sub
</script>

This is in the Boddy.
<td><INPUT TYPE=BUTTON NAME=Btn1 VALUE="Requirements Template"></td>

Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.