J
Josh Sale
I have an add-in which I'm trying to make compatible with XL2007 while still
supporting earlier versions of Excel. I've replaced my commandbars and
menus with new ribbon stuff. Each of my ribbon button's has an onAction
attribute that specifies the name of a VBA Sub in my add-in.
I'd like to code the subroutine as:
Sub ButtonClick(Control As Object)
or
Sub ButtonClick(Control As Variant)
to maintain compatibility with earlier versions of Excel which I can't do if
I code it as:
Sub ButtonClick(Control As iRibbonControl)
since iRibbonControl isn't defined in the earlier Excel libraries.
Unfortunately my approach doesn't work! When I click the button I get the
message:
run-time error 424
Object required
when my code tries to access one of the public properties of Control. If I
put Control into a Watch window, the type looks OK ("Object/iRibbonControl")
and if I expand it I see the public properties (Context, Id & Tag) but each
property has a value of "<Object required>".
Anybody got any explanation?
TIA,
josh
BTW, if I do code the Control argument as iRibbonControl then the rest of my
code works OK.
supporting earlier versions of Excel. I've replaced my commandbars and
menus with new ribbon stuff. Each of my ribbon button's has an onAction
attribute that specifies the name of a VBA Sub in my add-in.
I'd like to code the subroutine as:
Sub ButtonClick(Control As Object)
or
Sub ButtonClick(Control As Variant)
to maintain compatibility with earlier versions of Excel which I can't do if
I code it as:
Sub ButtonClick(Control As iRibbonControl)
since iRibbonControl isn't defined in the earlier Excel libraries.
Unfortunately my approach doesn't work! When I click the button I get the
message:
run-time error 424
Object required
when my code tries to access one of the public properties of Control. If I
put Control into a Watch window, the type looks OK ("Object/iRibbonControl")
and if I expand it I see the public properties (Context, Id & Tag) but each
property has a value of "<Object required>".
Anybody got any explanation?
TIA,
josh
BTW, if I do code the Control argument as iRibbonControl then the rest of my
code works OK.