View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
urkec urkec is offline
external usenet poster
 
Posts: 131
Default Activating a BAT file from a HTA

"Edmund" wrote:

I'm just trying to lauch the bat file when user click the button they see in
Internet Explorer.

My "Test.bat" file contains only te below 2 lines:
__________________________________________
prompt off
"C:\Test\LaunchSub.vbs" "Apple" "Banana"
__________________________________________

Fyi, this question is actually related to my earlier post entitled "Passing
argument from cmd.exe to Excel VBA".

I'm trying to achieve this:
In IE, when user press the button, it will trigger 'Test.bat' to launch.
This will inturn trigger 2 arguments be passed from "C:\Test\LaunchSub.vbs"
"Apple" "Banana" to Excel VBA.

Thanks a million!

--
Edmund
(Using Excel XP)



This will work in HTAs, but in a HTML page you may receive a security warning:

<HTML
<HEAD
<TITLETest Button Events</TITLE
</HEAD
<BODY
<FORM NAME="Form1"
<INPUT TYPE="Button" NAME="Button1" VALUE="Click"
<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd.exe 'C:\Test.bat'"
</SCRIPT
</FORM
</BODY
</HTML


--
urkec