(Solved) – Insert macro not in a module but in sheet Excel using interop Excel using c#


Need to insert vba code not in module, but in the sheet list

I have now:

“Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)rn”
” If Target.Column = 2 Then MsgBox “Ok” rn”
“End Sub”;

In c# I have

public static void InsertMacroInExcel(Microsoft.Office.Interop.Excel.Application app, Microsoft.Vbe.Interop.VBComponent xlMod)

string macroCode =




but this inserts in a module, not in a sheet

Help me please

Leave a Reply

Your email address will not be published. Required fields are marked *