Following this question, I'm trying to convert the VBScript code on this page to JScript. If I runt the below .hta
code:
<HTML>
<BODY>
<INPUT id=button1 name=button1 type=button value=Button>
<SCRIPT LANGUAGE="VBScript">
sub button1_onclick()
dim app
set app = createobject("Excel.Application")
app.Visible = true
dim wb
set wb = app.workbooks.add
end sub
</SCRIPT>
</BODY>
</HTML>
It opens an empty Excel sheet upon clicking on the button. as expected. However, if I convert the VBScript part to JScript
<HTML>
<BODY>
<INPUT id=button1 name=button1 type=button value=Button>
<script LANGUAGE="JScript">
function button1_onclick() {
// var app = WScript.CreateObject("Excel.Application");
var app = new ActiveXObject("Excel.Application");
app.Visible = true;
var wb = app.Workbooks.Add();
}
</script>
</BODY>
</HTML>
it doesn't open Excel at all when clicking the button. I would appreciate it if you could help me know what is the problem and how I can resolve it. Thanks for your support in advance.