PDA

View Full Version : Clicking a link to open Powerpoint program


?gkj
08-12-2003, 11:13 AM
I need it so that when the user clicks a link instead of just opening the powerpoint file in the browser, it will open the file in the Micorsoft Powerpoint Application. This is for an intranet and they have active X controls enabled.
I thought I have heard of this being done with JScript and active X.
Can anyone point me in the right direction for this?

Thanks!

?gkj
08-12-2003, 11:48 AM
I finally found the answer on another forum site. If you ever want to open a file in its application, here is the script:

<SCRIPT LANGUAGE=vbscript>
sub LaunchIt(URL)
dim SCO, doc, prog
set SCO = createobject ("WScript.Shell")
doc = chr(34) & URL & chr(34)
Ext = right(URL,3)
if Ext = "doc" or Ext = "dot" then prog = "Winword.exe "
if Ext = "xls" then prog = "Excel.exe "
if Ext = "ppt" then prog = "PowerPnt.exe "
if Ext = "htm" then prog = "IEXPLORE.exe "
SCO.Run prog & doc, 3, 0
set SCO = nothing
window.event.returnValue=false
end sub
</script>

<a href="#" onclick="LaunchIt('filename.doc')">Open It!</a>

Use it to open any number of extension types.