I want to run a .xlsm file from ASP.NET Web Page where it generates some .xml file using VBA code. The slution suggested here doesn't seem to work in my case.
I tried the following in nmy TestWebApp. My Webform1.aspx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="return Callxlsm(); "/>
</div>
</form>
</body>
<script type="text/javascript">
function Callxlsm() {
alert("Hello");
var MyObject = new ActiveXObject('WScript.Shell');
MyObject.Run('file:///K:\NLMData\POC\TestWebApp\TestWebApp\Files\AMM_ModelWizard.xlsm');
}
</script>
</html>
in my code behind
using System;
namespace TestWebApp
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("Hello");
}
}
}
Not sure whats the issue, any pointers pls.Also, can we pass in parameters to this Excel file from the Page so the excel file manipulates them in certain way and generates the XML file?