Just can’t imagine how stupid is that
You are releasing an add in to Visual Studio 2005 that allows you to write code to Microsoft Office, and you are not running enough tests before releasing it.
Don’t believe me Here is a simple scenario:
1- Create a new Microsoft word template with C# project.
2- In the document start event, add a new button to the toolbar; here is some code.
private void ThisDocument_Startup(object sender, System.EventArgs e)
{
Office.CommandBar standardCmd = this.CommandBars["Standard"];
Office.CommandBarControl save = standardCmd.Controls["Save"];
Office.CommandBarButton mySave = (Office.CommandBarButton)standardCmd.Controls.Add(
Office.MsoControlType.msoControlButton, this.missing, this.missing, save.Id, true);
mySave.Caption = "My Save";
mySave.TooltipText = "My Save";
mySave.Tag = "My Save";
mySave.Style = Office.MsoButtonStyle.msoButtonCaption;
mySave.Click += new Office._CommandBarButtonEvents_ClickEventHandler(mySave_Click);
}
void mySave_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
{
try
{
MessageBox.Show("Saved successfully");
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
3- Run the document and press on the new toolbar button “My Save”.
Result: a popup message will tell you saved successfully.
4- Now press on it again.
Results: nothing will happen.
Now, how can you convince a customer to use Microsoft Word for an enterprise project, if one of the simplest things is broken
Did you ever code any solution that is using Microsoft Word 2003 and Visual Studio .NET 2005 Or you are just experimenting on us again

We don’t test our code, Microsoft! (word toolbar events broken)
ridergroov
Your CommandBarButton object is being garbage collected by the .NET runtime when the ThisDocument_Startup method completes execution (since it is defined as local a variable). To work around this, declare your CommandBarButton object at the class level.
Digo21
Worked, thanks a lot!