473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Opening Word

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
7 1880
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
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
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
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
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
Secuirty in the intranet zone was the problem.
Thanks for all of your help.

Jul 23 '05 #7
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vinay | last post by:
Hi I have a corrupt word file. I am able to open it with the code given below tr Dim pInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo( pInfo.UseShellExecute...
0
by: Sivaraman.S | last post by:
Issue: When I am opening a word document or a template from an ASP.NET Web page (language used VB.NET Visual Studio Version 2003) using Word.ApplicationClass object (Reference Word 11.0 object...
1
by: Andy Davis | last post by:
Hi I've written the following code for a button on a form to open a mail merge document in MS Word. The code opens the document fine but does not display the usual connection details to open the...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
0
by: Sivaraman.S | last post by:
Issue : When I am trying to open a Word Document or a Template from a Web Application (ASP.NET Web page - Language Used VB.NET Visual Studio Version 2003) using Word.ApplicationClass (Refering...
1
by: ourspt | last post by:
Hi, We are working on an ASP.NET (VB.NET) application and we have a problem opening a word document from our application. When we try to open the word document, we do not get any error...
2
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to...
5
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it...
2
by: DigitalFusion | last post by:
Hello All, I have an app on an intranet which uses the response.contenttype in ASP to create a word doc. The issue I am having is that when this doc is generated and opened, the session is...
1
navanova
by: navanova | last post by:
Greetings, I have a problem of opening ms word and excel files on my computer. The files are there for a long time. I use to open and modify them. Suddenly, when i try to open the word files, a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.