Detecting the presence of commande bar "envelope"

Add-in Express™ Support Service
That's what is more important than anything else

Detecting the presence of commande bar "envelope"
 
Thomas Grossen


Guest


Hi again,

I am trying to detect the presence of the command bar "envelope" in my Outlook Add-in, in order to show my toolbar if word is the mail editor.

I have found your sample for a Word Add-in. Do you have some example how to find the toolbar from an Outlook Add-in?

Thank you.


Posted 08 Dec, 2006 04:31:38 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

You can download the example here:
http://www.add-in-express.com/projects/adx-ol-detect-word-d7.zip


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.


Posted 08 Dec, 2006 06:45:50 Top
Thomas Grossen


Guest


Dmitry,

When I run your sample, it works fine. But when I copy your code to my add-in, the CommandBars collection is not available in the Inspector. It rise an exception accessing it.

Do you have any idea why?

I also tried to move the code to the "NewInspector" Outlook event. Here I can access the CommandBars collection, but the "Envelope" command bar is not visible at this level.

Any suggestion may help :(
Posted 08 Dec, 2006 09:41:01 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

Do you have any idea why?

What Delphi version do you use?

I also tried to move the code to the "NewInspector" Outlook event.

I don't recommend using this event handler.

Posted 08 Dec, 2006 09:48:00 Top
Thomas Grossen


Guest


I use Delphi 2006, and Office 2003.

But your sample work, it is just in my project that I have te problem...
Posted 08 Dec, 2006 10:17:07 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

Could you please send me your project? I'll check it.

Posted 08 Dec, 2006 10:22:23 Top
Thomas Grossen


Guest


It is a ???big?? project that involves a lot of things. Let me try some other things.

If I don't find the problem until Monday I will send it to you...

Thank you.
Posted 08 Dec, 2006 11:56:06 Top
Thomas Grossen


Guest


Mmmm....

I have found where the problem is;

I have declared OutlookXP in the Uses, because I need it to work with the reminders collection that is not available in Outlook 2000.

If I remove OutlookXP from "uses", then your code works fine.

I am now trying to find a solutions to uses the reminders AND your code :)

:|
Posted 08 Dec, 2006 12:05:47 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

See the code below.


uses Office2000, [B]Outlook2000[/B], [B]OutlookXP[/B], Dialogs;

procedure TAddInModule.adxCOMAddInModuleOLInspectorActivate(Sender: TObject);
var
  CmdBar: CommandBar;
begin
  try
    CmdBar := [B]Outlook2000[/B].TInspector(Sender).CommandBars.Item['Envelope'];
    if Assigned(CmdBar) and CmdBar.Visible then
      MyInspectorCommandBar.Visible := False
    else
      MyInspectorCommandBar.Visible := True;
  except
    // not found
  end;
end;


Posted 08 Dec, 2006 12:28:04 Top
Thomas Grossen


Guest


I tried your solutions this morning. It works fine.

Thank you.
Posted 11 Dec, 2006 05:46:35 Top