In VSTO Excel document level application I need to add NamedRange controls on various worksheets. All examples I found show the creation of NamedRange from Worksheet_startup event like this:
Dim textInCell As Microsoft.Office.Tools.Excel.NamedRange
textInCell = Me.Controls.AddNamedRange(Me.Range("A1"), "cellText")
But I cannot seem to be able to create a named range control on a sheet from any other event but that Sheet_startup.
I want to create a named control on a sheet from my code on a custom control on a taskpane. If this is possible, could someone please point me to a code example
Thank you,
Marat.