Reputation: 266
I have an excel dna class library that contains a custom ribbon and a static class that contains my UDFs for the application.
How do I get a reference to the ribbon from the class containing the UDFs.
For information my ribbon contains a reference to some settings (entered in a form) that I also want available to the functions in my UDF class.
Upvotes: 1
Views: 363
Reputation: 27898
Hmm... Having your UDFs tightly coupled with a Ribbon doesn't seem like a good design IMO. A UDF should not know anything about the existance of a Ribbon or Form...
I'd suggest you create a static class to store configuration settings that you can use in your UDFs, assign default values to these settings, so that your UDFs work out-of-the-box, and let the user override these settings through the form that you are opening through the Ribbon... i.e. When the user changes these settings, you simply update your static configuration class, and your UDFs won't have to have any knowledge of the Ribbon or Form...
Upvotes: 1
Reputation: 16907
I think you can store the ribbon instance in a static variable when it is created (i.e. in your ExcelRibbon
-derived classes constructor).
Upvotes: 1