As far as I understand, you need an intermediate call for the code / macromodule from button when you click on the button. In this way, the code runs and does what you want.
. In the usual way, for example,
- we add a button to the excel sheet.
- select
on_click event - add code like
call mySub
You need to do this in C #.
Please configure for your module and manage names. Here is an example.
//Within your above code add, sheetBtn.Click += new MSForms.CommandButtonEvents_ClickEventHandler(sheetBtn_Click); } //button click event triggers void sheetBtn_Click() { call subMain // try a test using : MessageBox.Show("button test!"); }
** PLEASE READ THIS MANUAL It has pretty much what you need.
According to the object, by simply connecting the subsite of a worksheet or module written in Excel from C #, you can use the run macro method.
//instead of this.application, you call refer to the Excel app object this.Application.Run("yourMacroName",missing,missing........)
Link:
source share