HighDots Forums  

Opening Word

Javascript JavaScript language (comp.lang.javascript)


Discuss Opening Word in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rockocubs
 
Posts: n/a

Default Opening Word - 04-01-2005 , 09:50 AM






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.


Reply With Quote
  #2  
Old   
kaeli
 
Posts: n/a

Default Re: Opening Word - 04-01-2005 , 10:53 AM






In article <f58738fd3de0dfd477738dca4e229d01
@localhost.talkaboutprogramming.com>, rphipps (AT) nospam (DOT) indy.rr.com enlightened
us with...
Quote:
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



Reply With Quote
  #3  
Old   
rockocubs
 
Posts: n/a

Default Re: Opening Word - 04-01-2005 , 11:46 AM



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


Reply With Quote
  #4  
Old   
rockocubs
 
Posts: n/a

Default Re: Opening Word - 04-01-2005 , 02:32 PM



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'


Reply With Quote
  #5  
Old   
kaeli
 
Posts: n/a

Default Re: Opening Word - 04-01-2005 , 03:49 PM



In article <9d6622be3b06ccd66e9f4ed6c57632d1
@localhost.talkaboutprogramming.com>, rphipps (AT) nospam (DOT) indy.rr.com enlightened
us with...
Quote:
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/archive/2004/04/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



Reply With Quote
  #6  
Old   
rockocubs
 
Posts: n/a

Default Re: Opening Word - 04-01-2005 , 04:41 PM



Secuirty in the intranet zone was the problem.
Thanks for all of your help.


Reply With Quote
  #7  
Old   
rockocubs
 
Posts: n/a

Default Re: Opening Word - 04-05-2005 , 03:51 PM



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>


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.