View Single Post
  #5  
Old March 28th 08, 04:03 PM posted to microsoft.public.outlook.program_addins
Goran
external usenet poster
 
Posts: 48
Default VB 6 COM Add-in for Outlook 2007

Thanks a lot as always Ken.

This thing worked, and I am able to route callbacks to my specific Wrapper
code. But now I am confused. I used to have dropdown control in inspector
wrapper that I declared as:
Private WithEvents CBInspectorDropdown As Office.CommandBarComboBox,

and then I pull the items from DB and populated this dropdown when Inspector
opened. I also had _Change event for the dropdown where I would put the code
to do something based on user selection. Now, I defined dropdown in xml. How
can i reference that dropdown in my code in vb 6 and load with items in the
runtime, get selected item etc.

thanks,

Goran

"Ken Slovak - [MVP - Outlook]" wrote:

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



Ads