View Single Post
  #1  
Old February 14th 07, 01:18 AM posted to microsoft.public.outlook.program_addins
Beiley
external usenet poster
 
Posts: 4
Default Can't get CommandBars in 2007, works in other Outlook versions?

My COM Add-in for Outlook works fine in 2000, XP, and 2003, but in
2007 I can't get the CommandBars. I get an exception when I try.
Here is my code:


Outlook::_Explorer* spExplorer = g_ppvApplication-ActiveExplorer();
if( spExplorer != NULL )
{
Office::_CommandBarsPtr spCmdBars;
try
{
spCmdBars = spExplorer-CommandBars;
}
catch(...)
{
// This gets called in Outlook 2007 only!
Why??

DebugTrace( DEBUG_TRACE_BASIC, "Failed to get CommandBars\n");
return;
}
}

This code is being called from my 'OnStartupComplete' function. Any
ideas/suggestions?

Thanks,
Mark
http://www.beiley.com

Ads