Hello,
I would like to create a custom button (or custom command bar) in contact's
form.
I already created custom button on "standard" command ...
plzzzzzzz help :)
CommandBars oCommandBars;
CommandBar oStandardBar;
try
{
oCommandBars =
(CommandBars)applicationObject.GetType().InvokeMember("CommandBars",
BindingFlags.GetProperty , null, applicationObject ,null);
}
catch
{
object oActiveExplorer;
oActiveExplorer=
applicationObject.GetType().InvokeMember("ActiveExplorer",BindingFlags.GetProperty,null,applicationObject,null);
oCommandBars=
(CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars",BindingFlags.GetProperty,null,oActiveExplorer,null);
}
oStandardBar = oCommandBars["Standard"];
try
{
MyButtontest= (CommandBarButton)oStandardBar.Controls["MyButtontest"];
}
catch
{
object omissing = System.Reflection.Missing.Value ;
MyButtontest = (CommandBarButton) oStandardBar.Controls.Add(1, omissing ,
omissing , omissing , omissing);
MyButtontest.Caption = "test";
MyButtontest.Style = MsoButtonStyle.msoButtonIconAndCaption;
MyButtontest.Style = MsoButtonStyle.msoButtonIconAndWrapCaptionBelow;
MyButtontest.Tag = "Synchronisation";
MyButtontest.OnAction = "!<MyButtontest.Connect>";
MyButtontest.FaceId = 3199;
MyButtontest.Visible = true;
MyButtontest.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this.MyButtontest_Click);
}
object oName =
applicationObject.GetType().InvokeMember("Name",BindingFlags.GetProperty,null,applicationObject,null);
oStandardBar = null;
oCommandBars = null;
Helmut Obertanner - 29 Nov 2005 22:27 GMT
I don't know if it helps, but maybe you will find my X4UTools sample
here usefull.
Deals with Explorers and Inspectors and Toolbars and Buttons.
It's a VSTO Sample, but the code for the Buttons is just the same.
http://www.x4u.de/Outlook/Samples/tabid/77/Default.aspx
with regards / mit freundlichen Grüßen
Helmut Obertanner
X4U electronix
web: www.x4u.de
... X4U rocks !
> -----Original Message-----
> From: Raphael [mailto:r.michel@analytel.com]
[quoted text clipped - 87 lines]
>
> oCommandBars = null;