Recently, a series of work to do the maintenance of the website, so do a lot of support tools. There are VBA in Excel, there are tools for direct C # to do. There are times when you need to perform Excel VBA macros in C #, and sometimes even after you execute a VBA macro, get the return value and then handle it accordingly. For ease of use, I've written a Help class that performs Excel VBA macros. Doing a backup on a blog also helps a friend with similar needs.
The Help class provides only one method: Runexcelmacro
Parameter description:
string Excelfilepath Excel file path
string macroname Macro Name
object[] Parameters Macro parameter Group
Out object Rtnvalue macro return value
BOOL Isshowexcel Whether Excel is displayed when executed
Additional Note: VBA macros need to be written in the following diagram in the module in order to be recognized by this method. Written in ThisWorkbook cannot be identified.