I am using C# to build an Excel AddIn by VSTO, one thing I want to do is automatically import a VBA module which I wrote(a .bas file ) into Excel and run it when the user importing my Excel AddIn from Com AddIns in Excel.
I tried like:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.Run(@"C:\myModule.bas");
}
But got errors: Cannot run the macro 'C:\myModule.bas'. The macro may not be available in this workbook or all macros may be disabled.
Thanks in advance to people who read my question!