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:

  1. Fill some fields at excel worksheet.
  2. Run macro.
  3. 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 ;)

Answers


You could try using Excel.Interop developed in framework. So you could open your excel file and then:

  1. Fill some fields using Interop
  2. Run macro with code containded in this link
  3. 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...


Need Your Help

Visual Studio 2010/Resharper Plugin development

visual-studio-2010 plugins resharper intellisense

I am having trouble tracking down information regarding extending Intellisense. It looks like creating a plugin for VS 2010 or Resharper would do the trick. However, I can't find any documentation ...

Rendering and printing stuff with PHP: PDF, HTML or …?

php html pdf printing render

I'm coding a system to manage Teams in a event, and i need to print badges for each person in the event.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.