That's where the sneaky part comes in
In cases like that I put a public property in my Inspector wrapper class
called Ribbon that is set to the Ribbon object in my Connect class (or you
can make the Ribbon object in Connect global). I also put in the wrapper
class a public Sub that I usually call RibbonClicker().
I also have a public Inspector property in the wrapper class that returns
the Inspector for that class.
In Outlook 2007 you can directly compare control.Context from the ribbon
callback to the Inspector property in each existing wrapper class instance
using equality:
If (control.Context = wrapper(i).Inspector) Then
So I always can get the correct Inspector wrapper class.
I then call into the wrapper class's RibbonClicker() procedure, passing
along the ribbon control.ID as an argument to RibbonClicker().
In RibbonClicker() I compare the id (ribbon control tag) to the tags for all
the available ribbon controls and from that I know which control was clicked
and which button event handler it corresponds to. I then set up a dummy null
CommandBarButton and a dummy boolean Cancel variable and pass those to the
appropriate button click event handler, which then executes the code for
that event handler.
In cases where I need to pass other information to the eventual procedure to
handle the clicks I have both the button event handler and the ribbon
clicker procedure call the same child procedure to execute the click code.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"goran" wrote in message
...
Thanks Ken for your prompt reply. I used Dennis's tlb to fork the code and
create CommandBar if it is version 11 or use GetCustomUI method in connect
module in the case of office 12.
I have my xml file for the ribbon. When I run it it shows up nicely, but
how
can I hook the onAction to run the code that I already have for
Button_click.
When specifying onAction callback it tries to find it in connect designer
module, and my buttons and associated events are declared my Inspector
wrapper class.
Thanks,
Goran