using commandBars fails

N

news.microsoft.com

Hi

I started looking at writing addins for Outlook and found what looks like a
very nice intro text on the subject

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/ol03csharp.asp

I copied the source into Visual studio, compiled and installed. But nothing
happend. Then I added some MessageBoxes to tell me more.

Tried:

MessageBox.Show(commandBars.GetType().ToString());
MessageBox.Show(commandBars.ActiveMenuBar.Name);

btnGetEMailStats = (CommandBarButton)

commandBars["Standard"].Controls.Add(1,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value);

The secound MessageBox fails as it seams all "uses of" commandBars gives me
a NullReferenceException - well note CommandBars.getType(), but
commandBars.GetEnumerator or commandBars["Standard"] and so on.

What could be wrong? I have seen this example all over - getting the
commandBars and looking for and index "Standard" and so on. The example was
taken as is - I did not change anything at first and only added
MessageBox.Show commands...

Best Regards

Jan Agermose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top