|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
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 ![]() |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Launching MS Word to open file from a hyperlink? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|