How to integrate application with excel macros?
I have to find the best way to integrate my application with excel. Basically, I have to make some fancy frontend for filling input data, and later showing the output. The calculations have to be made in .VBA macro. Basically:
- Fill some fields at excel worksheet.
- Run macro.
- Fetch data from specific columns.
What we did before was to have excel .vba macro be auto-execute on open, fetch data from file, and then output it to another one. Then the application would just have to write input data to file, exec .xls and wait for output file. This approach obviously has many limitations: no error reporting, having to wait for file to appear, lots of hustle to get filepaths correct.
Are there any good ways to achieve that, for example using some .NET magic? I am open to all solutions, including all kind of technologies and languages ;)
You could try using Excel.Interop developed in framework. So you could open your excel file and then:
- Fill some fields using Interop
- Run macro with code containded in this link
- Fetch data using Interop
In this link you can find something useful with Excel.Interop. Anyway if you search "C# Excel example" in Google you find tons of examples...