ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 18th, 2003, 02:57 PM
wluu wluu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 2 wluu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Launching MS Word to open file from a hyperlink?

Wondering if this can be done. I have the path generated from asp variables. I have the following code:

<a href="file:<%=sPath & sYear & "\" & sFileName%>" TARGET="_blank">Open Generated File</a>

This will launch the file in an IE window. I was wondering if it would be possible to have the same link above but have word open the file instead of IE? Have something like a jscript function that does onclick...blah..blah. Is this possible? If so, any sample coding or where to get more information would be great

Reply With Quote
  #2  
Old March 18th, 2003, 07:40 PM
vaLeech vaLeech is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 vaLeech User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If you link to a .doc file and the user's machine has a file association setup so that .doc files are opened with Word, whenever they click on the link it will open the file with word. You can put this in a new window using the target property as you have done in your example.

Just make sure the file that is linked to is a .doc

HTH

Reply With Quote
  #3  
Old March 19th, 2003, 09:32 AM
wluu wluu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 2 wluu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hey valeech,

tks for the reply. I tested out the file association and my machine already has .doc files associated with MS Word. I kept the target=_blank, should this be changed? As an alternative, in case anyone here wanted to know, I found some jscript code that does this for you. Here is the sample coding that I used to launch the link in MS Word:

<a href="javascript:startWord('<%= sPath2 &sYear& "/"& sFileName%>')">Open Generated File</a>

and add the following jscript:

<script language="JavaScript">
function startWord(strFile)
{
var myApp = new ActiveXObject("Word.Application");
if (myApp != null)
{
myApp.Visible = true;
myApp.Documents.Open(strFile);
}
}
</script>


Note: in order to link to UNC paths, make sure that strFile is using "/" in its path versus the conventional "\". For eg. use:
//computer/folder/file instead of \\computer\folder\file.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Launching MS Word to open file from a hyperlink?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap