?
Solved

Launch Office program from browser hyperlink

Posted on 2003-03-20
7
Medium Priority
?
718 Views
Last Modified: 2012-06-27
Hi

I'm after some javascript that will open an MS Office 2000 document in the appropriate Office program (Word, Excel etc.) from a hyperlink in a web page (IE6) instead of opening it inside the browser.

I get "Error on page" when I try using the javascript solution at Whirly Wiry Web:
http://whirlywiryweb.com/article.asp?id=%2officedocs&xml=0

Do you have a reliable alternative?

I realise there may be a solution in the Experts-Exchange archives somewhere but I've had no joy finding anything.

Very many thanks for your assistance.

Regards
0
Comment
Question by:Beauchamp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 14

Accepted Solution

by:
avner earned 200 total points
ID: 8173376
Launch word for example :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<!--Avner , avnerC@fundtech.co.il-->
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function openWord(moshe) {
var wrdApp = new ActiveXObject('Word.Application');
wrdApp.Documents.Open(moshe);
wrdApp.Visible = true;


}


//-->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF">
<form>
Choose MSWord file  : <input type="file" id="moshe"><br>
<input type="button" value="Open Word" onclick="openWord(this.form.moshe.value)">
</form>
</BODY>
</HTML>
0
 

Author Comment

by:Beauchamp
ID: 8179594
Thanks for the reply avner. I adapted your code for a standard hyperlink rather than a form submission. Still getting "Error on page". Perhaps it's a problem with our browser.

Any alternative javascripts/DHTML to solve the problem would still be welcome.

Thanks

0
 
LVL 14

Expert Comment

by:avner
ID: 8193404
What browser you are running with?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:djmcrae
ID: 8332721
Yep, I have found that on some client machines, I have this same problem - and it is dependant on logon. I don't have the answer as yet.
If you put a

try{
  ......
)
catch(e){
  alert(e.description);
}

you'll get either a 'permission denied', or 'automation server can't create object' depending on your logon rights - on some of my logons though, it works OK. I'm trawling the internet now to find a registry compare to find out if IE or word settings are different - although, some time ago I had FTP server setting problems and gave both the two accounts that work local logon rights - I'll be giving this a shot tomorrow. Ill let you know how I go.

0
 

Expert Comment

by:djmcrae
ID: 8332860
I forgot to mention, in your case, make sure you have enabled (or to prompt) 'Run and initialise scripts not marked as safe' and 'Run activeX controls and plugins' - but I've already done this to all accounts on 1 machine and it still fails on half of them.
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10149085
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: avner {http:#8173376}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question