I have written some code in VBA in excel sheet where it converts a text file to excel sheet and perform some validation on data to filter the correct data and error data and separating it in correct text file and error text file. The entire logic is run when the excel is opened. The logic of opening this excel is written in my .net application in c#.

The code is:

FileInfo fi = new FileInfo("C:\automate_load.xlsm");

if (fi.Exists)
{
Excel.Application excelapp = new Excel.Application();
excelapp.Visible = true;
Excel.Workbook wb = excelapp.Workbooks.Open("C:\automate_load.xlsm", 0,
false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
}

When I open the automate_load.xlsm file manually, the entire VBA code is running properly but when the file is opened by my c# code nothing happens.

I think when the file is opened automatically, micros gets disabled. Please help me with some solution. Thanks in advance....