D
donh
I have a spreadsheet that is to be useable in both Excel 2007 and 2003. In
the 2007 version, there is customized Ribbon support. I have isolated all
the ribbon callback functions in a separate VBA module, and it seems that
when the spreadsheet is opened in Excel 2003 (which of course does not invoke
any of the callback functions) that module is never compiled, and so
everything works.
Except: There is one place where I need to have code that might call one of
the ribbon functions: In a Worksheet_Activate method, I need to invoke the
IRibbonUI.Invalidate method when in 2007. Even though the code can test for
the Application.Version and not call the invalidation procedure, the very
presence of the statement that references that procedure makes VBA want to
compile the module that has ribbon code in it. Of course, that doesn't work
in Excel 2003 -- none of those objects is known.
Is there any way to "trick" VBA in Excel 2003 into allowing code that
references ribbon things to compile. I have no intention of actually calling
or executing any of that code, but I can't figure out how to keep it from
being referenced and thus causing compile errors.
One obvious solution is to change the VBA code itself between the 2007 and
2003 versions of the spreadsheet. But the whole point here is to have a
common set of stuff that works in both places, unchanged.
Thanks,
-don h
the 2007 version, there is customized Ribbon support. I have isolated all
the ribbon callback functions in a separate VBA module, and it seems that
when the spreadsheet is opened in Excel 2003 (which of course does not invoke
any of the callback functions) that module is never compiled, and so
everything works.
Except: There is one place where I need to have code that might call one of
the ribbon functions: In a Worksheet_Activate method, I need to invoke the
IRibbonUI.Invalidate method when in 2007. Even though the code can test for
the Application.Version and not call the invalidation procedure, the very
presence of the statement that references that procedure makes VBA want to
compile the module that has ribbon code in it. Of course, that doesn't work
in Excel 2003 -- none of those objects is known.
Is there any way to "trick" VBA in Excel 2003 into allowing code that
references ribbon things to compile. I have no intention of actually calling
or executing any of that code, but I can't figure out how to keep it from
being referenced and thus causing compile errors.
One obvious solution is to change the VBA code itself between the 2007 and
2003 versions of the spreadsheet. But the whole point here is to have a
common set of stuff that works in both places, unchanged.
Thanks,
-don h