• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 724
  • Last Modified:

Launch Office program from browser hyperlink

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
Beauchamp
Asked:
Beauchamp
1 Solution
 
avnerCommented:
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
 
BeauchampAuthor Commented:
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
 
avnerCommented:
What browser you are running with?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
djmcraeCommented:
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
 
djmcraeCommented:
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
 
jaysolomonCommented:
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

Industry Leaders: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now