D
Dave Jenkins
I have developed an applicaiton which will run in either PPT 2007 or PPT
2003. If it's running in 2003, it manipulates menus and toolbars, and if
it's in 2007, it manipulates the ribbon. Works great, and all I have to do
is install a .ppa version of the code in 2003, and a .ppam in 2007, and
that's pretty automatic -- the installer takes care of decisions like that.
About the only hassle is having to do two different saves each time I want to
run some tests. But no code changes are required to satisfy the differing
requirements of 2003 vs. 2007.
That is, until this weekend, when all of a sudden the addin quit loading on
2003. And here's why:
It appears that the addin loader in 2003 is smart enough to look at the
module definition of subs, functions, etc. that are explicitly called in the
addin's vba code. In my case, I had this code, and had added the indicated
sub and inserted a call to it in some form code:
Private myRibbon As IRibbonUI
Sub WISToolsCustomUI_onLoad(ribbon As IRibbonUI)
Set myRibbon = ribbon
End Sub
Sub InitializeRibbon() <------ added code
myRibbon.Invalidate <------- added code
End Sub <-------- added code
All I had to do to make the code load in 2003 was to comment out the call to
InitializeRibbon(). However, that, of course, crippled my 2007 ribbon
manipulation code. (Note: I think it's interesting that the 2003 loader
doesn't barf at the existence of a variable definition that it really doesn't
know about (IRibbonUI), it's only when it sees a call to a sub in a module
that contains a module level definition that it refuses to load.)
I've tried for hours to figure out a way to let the app compile on 2007, and
load as an addin on both platforms without having to change the code to
satisfy both the 2003 and 2007 addin loaders. I've tried, for instance, just
defining MyRibbon as an Object, but that doesn't work. (Does VBA have a Cast
or a type convrsion or something that would help?)
Can I accomplish what I'm after here, or do I have to bite the bullet and
add an extra step to my development procedure?
Thanks!
2003. If it's running in 2003, it manipulates menus and toolbars, and if
it's in 2007, it manipulates the ribbon. Works great, and all I have to do
is install a .ppa version of the code in 2003, and a .ppam in 2007, and
that's pretty automatic -- the installer takes care of decisions like that.
About the only hassle is having to do two different saves each time I want to
run some tests. But no code changes are required to satisfy the differing
requirements of 2003 vs. 2007.
That is, until this weekend, when all of a sudden the addin quit loading on
2003. And here's why:
It appears that the addin loader in 2003 is smart enough to look at the
module definition of subs, functions, etc. that are explicitly called in the
addin's vba code. In my case, I had this code, and had added the indicated
sub and inserted a call to it in some form code:
Private myRibbon As IRibbonUI
Sub WISToolsCustomUI_onLoad(ribbon As IRibbonUI)
Set myRibbon = ribbon
End Sub
Sub InitializeRibbon() <------ added code
myRibbon.Invalidate <------- added code
End Sub <-------- added code
All I had to do to make the code load in 2003 was to comment out the call to
InitializeRibbon(). However, that, of course, crippled my 2007 ribbon
manipulation code. (Note: I think it's interesting that the 2003 loader
doesn't barf at the existence of a variable definition that it really doesn't
know about (IRibbonUI), it's only when it sees a call to a sub in a module
that contains a module level definition that it refuses to load.)
I've tried for hours to figure out a way to let the app compile on 2007, and
load as an addin on both platforms without having to change the code to
satisfy both the 2003 and 2007 addin loaders. I've tried, for instance, just
defining MyRibbon as an Object, but that doesn't work. (Does VBA have a Cast
or a type convrsion or something that would help?)
Can I accomplish what I'm after here, or do I have to bite the bullet and
add an extra step to my development procedure?
Thanks!