variable length arguments

N

NA_AB

Hi all,
I’m trying to build an excel addin using c# and visual studio. In my addin,
I’m generating a button which I want to be displayed as soon as I open my
excel. I did the COM registration also. The button is showing up but only
after I start writing a “formula†in an excel cell like (=sum, =count) etc. I
shifted my 'add button' code between 'Onstartup Complete' and 'Onconnection'
of Connect.cs but of no use.

thanks in advance
 
C

Cindy M.

Hi =?Utf-8?B?TkFfQUI=?=,
I'm trying to build an excel addin using c# and visual studio. In my addin,
I'm generating a button which I want to be displayed as soon as I open my
excel. I did the COM registration also. The button is showing up but only
after I start writing a "formula" in an excel cell like (=sum, =count) etc. I
shifted my 'add button' code between 'Onstartup Complete' and 'Onconnection'
of Connect.cs but of no use.
I think you need to show us the code in question that creates the button. It would
also help if you told us which version of Office is involved...

Please also explain the connection of the subject line ("variable length
arguments") with the question you state in the body of the message.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :)
 
N

NA_AB

hey Cindy, apologies for having given a totally irrelevant subject line,
unknowingly I missed it.

the code you asked for is:

public void OnStartupComplete(ref Array custom)
{
try{

commandBar =
(CommandBar)myApplication.CommandBars.Add("MYCommandBar",Type.Missing,Type.Missing, true);
commandBar.Visible = true;
this.commandBar.Position = MsoBarPosition.msoBarTop;
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
try
{
firstButton = (CommandBarButton)commandBar.Controls["GUIDE"];
}
catch ( Exception )
{
firstButton =
(CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton,
Type.Missing,Type.Missing, Type.Missing, Type.Missing);
firstButton.Caption = "GUIDE";
firstButton.FaceId = 86;
firstButton.Click +=
new _CommandBarButtonEvents_ClickEventHandler(ButtonClick);
}
}
 
C

Cindy M.

How about if you explicitly set
firstButton.Visible = true;
catch ( Exception )
{
firstButton =
(CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton,
Type.Missing,Type.Missing, Type.Missing, Type.Missing);
firstButton.Caption = "GUIDE";
firstButton.FaceId = 86;
firstButton.Click +=
new _CommandBarButtonEvents_ClickEventHandler(ButtonClick);
}

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
N

NA_AB

hey Cindy, i tried placing the 'firstButton.Visible = true' in the code, but
still, the button is not being displayed as soon as excel startsup.

This thing has been persistent for many days now and am not able to find out
what I am missing.

Any valuable suggestions are considered very thankful

Regards,
na_ab
 

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