I am trying to create a program in C# which imports a module of type sab (saved on the computer) on an Excel file saved on the computer
And it will not be mandatory to have Microsoft Office installed on the computer.
I am using the Epplus library for Excel. I saw that it is suggested to import and create a VBA file and then insert the sab code. I haven’t found how to do it exactly.
Before that I imported a CSV file and created an Excel file from it and on this Excel (sheet1). I need to run a module.
I don’t know how to import the sab file and run it in the module
Would appreciate help
var file11 = new FileInfo(@"C:\Users\master\Tochniot_Kshurot.csv");
// using var package11 = new ExcelPackage();
var sheet1 = package.Workbook.Worksheets.Add("Sheet1");
var ts = TableStyles.Dark1;
sheet1.Cells["A1"].LoadFromText(file11, format11, ts, FirstRowIsHeader: true);
string sabFilePath = "M:/Module1.bas";
string excelFilePath = @"C:\Users\2.3-sheet.xlsx";
var sabCode = new FileInfo(sabFilePath);
package.Workbook.CodeModule.Code = sabCode.ToString();
var codeModule = new CodeModule(sabCode);
var result = codeModule.Run(sheet1);
var data = worksheet.Cells.ToJaggedArray<object>();
I can’t find the code anymore. I tried to import and create a VBA file and add as a module and run, but didn’t work.
Bat-sheva is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.