View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default How to map a shortcut key to a routine in COM AddIn for Excel 2007

"GS" wrote in message
...
Peter T formulated on Tuesday :
Sorry Gary but we seem to be going round in circles here, let's start
afresh with what it is I'm missing (sorry if you've tried to make it
clear a dozen times!)

1. If the dll is to contain things like Implements 'IRibbonExtensibility'
we both agree it must have the reference set to v12.


The ref I speak of here is what we set in ProjectReferences, and must be
for M$O12 Lib and Excel12 Lib. (Not to be confused with what version we
set in the designer setup, which should be the earliest version we expect
our COMAddin to be used with)

2. If the dll has the ref to v12 it will not work in earlier versions. To
work in all of 2000,2 & 3 it must have the ref set to v9. That means to
cater for all versions it means must make two dll's, with ref's v9 & v12
respectively.


Incorrect! Since the earlier versions don't recognize the
IRibbonExtensibility interface, they just ignore the code and so the
ProjectRefs as well. No error is raised since the code that uses the
interface is never executed by the earlier versions.

3. You have repeatedly said you only make one ComAddin for all versions
2000 to 2007 (with an xla wrapper)

It would seem at least one of the three statements is mutually exclusive.
Or are you saying you make a single dll with the ref to v12, but because
when in use with an earlier version no v12 stuff gets called therefore
all works fine.


Exactly!

Regards,
Peter T

PS yeah on the testing stuff, use whatever way suits you best, test in
VBA and/or VB6


Sorry if I've been unable to make it clear in whole. I guess the confusion
is mostly because I tried to answer each of your comments/questions in
context. Given that you were confused about some of the stuff you were
asking, I finally started qualifying your statements as 'correct' or
'incorrect' in hopes that things became more clear to you. Obviously it
worked because points 1,3 pretty much summarize the COMAddin's structure.
I wasn't sure it would work, myself, but I tried it out. Result is it
works really well!

regards,
Garry


OK all clear now! That said I'm surprised. Actually I've never even bothered
to test a dll with the ref set to v12 in earlier versions. Reason is when
I've accidentally set the ref to v11, then tried it in Excel 2000/v9
problems have occurred (not surprisingly). I suspect though it depends on
what the code is actually doing. Indeed sometimes ref's to set to later
version than 'used-in' do version work, but not always. Obviously if
everything has always worked this way for you then if it works it works.
Intuitively though I'd be nervous, and don't think I'd do it that way even
if it apparently works.

Given that you were confused about some of the stuff you were asking,


Don't think I was ever confused about my own questions, just not fully
absorbing what you had in fact said but thinking it couldn't be, hence my
confusion. Anyway, thanks for being patient!

Regards,
Peter T