Hi Paul,
For your ribbon to call code in your ExcelRibbon-derived class you
need to add some (non-static) methods to the class, and update the
ribbon .xml.
Something like this will work with the .cml you've shown:
[ComVisible(true)]
public class Class1 : ExcelRibbon
{
public void OnButtonPressed(IRibbonControl control)
{
FormRegistration fr = new FormRegistration();
fr.ShowDialog();
}
}
Regards,
Govert
On Jul 30, 6:44 pm, Paul Menefee <
paul.mene...@gmail.com> wrote:
> UPDATE: I was able to open the WPF form via a function, but this is not
> the desired outcome. It seems I do not have access to my library from the
> ribbon but do from functions.
> namespace myLibrary
> {
> [ComVisible(true)]
> public class Class1 : ExcelRibbon
> {
> [ExcelFunction(Description = "Regstration Number", Category =
> "Useful functions")]
> public static void testpopup()
> {
> FormRegistration fr = new FormRegistration();
> fr.ShowDialog();
> }
> }
>
> }
>
> <DnaLibrary Name="myLibrary" Language="C#">
> <ExternalLibrary Path="myLibrary.dll" />
> <CustomUI>
> <!-- Inside here is the RibbonX xml passed to Excel -->
> <!-- This can also be loaded by Excel 2007 because of the namespace -->
> <customUI xmlns='
http://schemas.microsoft.com/office/2006/01/customui'
> loadImage='LoadImage'>
> <ribbon>
> <tabs>
> <tab id='CustomTab' label='My Test'>
> <group id='SampleGroup' label='Sample Group'>
> <button id='Button1' label='Button Label' image='M'
> size='large' onAction='RunTagMacro' tag='ShowHelloMessage' />
> <button id='Button2' label='Second Button' image='M'
> size='normal' onAction='OnButtonPressed'/>
> <button id='Button3' label='Register' image='M' size='normal'
> onAction='CallbackOnAction'/>
> </group >
> </tab>
> </tabs>
> </ribbon>
> </customUI>
> </CustomUI>
> </DnaLibrary>
>
>
>
>
>
>
>
> On Monday, July 30, 2012 11:50:44 AM UTC-4, Paul Menefee wrote:
>
> > I'd like used Excel-DNA to create a custom ribbon tab and added functions
> > and buttons. I would now like to have the user enter settings for the
> > add-in. Things such as parameters the functions will use for its
> > calculations and basic user information. I realize that I could enter this
> > data in a spreadsheet but I'd rather not if possible.