Novice: Custom Menu in Office?

P

Peter

Hello,

Thanks for reviewing my question. I would like a general
idea (or point me to an example) on how to create a
custom menu (File, Edit, ..., Custom) in Word or Excel
when my COM addin starts up.

I followed one of C# example on creating a custom button
addin, but now would like to know how can I insert a menu.

Many Thanks
Peter
 
P

Peter Huang [MSFT]

Hi Peter,

Here are a few helpful links. You may take a look.

http://groups.google.com/groups?q=addin+office+"custom+menu"+sample&hl=z
h-CN&lr=&ie=UTF-8&oe=UTF-8&selm=%23eZP0if3AHA.1308%40tkmsftngp07&rnum=1
http://groups.google.com/groups?q=addin+office+"custom+menu"+sample&hl=z
h-CN&lr=&ie=UTF-8&oe=UTF-8&selm=ud%23UqcTe%24GA.223%40cppssbbsa02.microsoft.
com&rnum=6
http://groups.google.com/groups?q=addin+office+"custom+menu"+sample&hl=z
h-CN&lr=&ie=UTF-8&oe=UTF-8&selm=YFVxBn87CHA.1532%40cpmsftngxa08.phx.gbl&rnum
=5

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
 
P

Peter Huang [MSFT]

Hi Peter,

Here a sample code about customize menu.
private void button1_Click(object sender, System.EventArgs e)
{
Excel.Application exApp = new Excel.ApplicationClass();// =
(Excel.Application)Marshal.GetActiveObject("Excel.Application");
object o = Missing.Value;
exApp.Visible=true;
Office.CommandBarPopup MenuObject=
(Office.CommandBarPopup)exApp.CommandBars[1].Controls.Add((object)10,o,o,(ob
ject)10,(object)true);
MenuObject.Caption="TestMenu";
Office.CommandBarButton mItem=
(Office.CommandBarButton)MenuObject.Controls.Add((object)1,o,o,o,o);
mItem.Caption="Test";
mItem.Click+=new
Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(mItem_Click)
;
}

private void mItem_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref
bool CancelDefault)
{
MessageBox.Show("hello");
}

You may take a look.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
X-Tomcat-ID: 173134736
References: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: (e-mail address removed) (Peter Huang [MSFT])
Organization: Microsoft
Date: Thu, 18 Sep 2003 06:16:21 GMT
Subject: RE: Novice: Custom Menu in Office?
X-Tomcat-NG: microsoft.public.office.developer.com.add_ins
Message-ID: <[email protected]>
Newsgroups: microsoft.public.office.developer.com.add_ins
Lines: 49
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.office.developer.com.add_ins:4533
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Hi Peter,

Here are a few helpful links. You may take a look.

http://groups.google.com/groups?q=addin+office+"custom+menu"+sample&hl= z
h-CN&lr=&ie=UTF-8&oe=UTF-8&selm=%23eZP0if3AHA.1308%40tkmsftngp07&rnum=1
http://groups.google.com/groups?q=addin+office+"custom+menu"+sample&hl=
z
h-CN&lr=&ie=UTF-8&oe=UTF-8&selm=ud%23UqcTe%24GA.223%40cppssbbsa02.microsoft
 

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