Custom context menu in Word 2007 executing code in Add-In

R

raidevnet

My solution is a Word 2007 add-in with custom buttons in the ribbon.
The users want to access some functionality provided by the add-in from a
context menu.
I've found article that describes how do do this in VBA.
http://gregmaxey.mvps.org/Customize_Word2007_SC_Menu_Programatically.htm

'Identify the module and procedure to run
.OnAction = "MySCMacros.RunMyFavMacro"

Is it possible to follow the same idea in .NET and, is so, how can I specify
the handler in the add-in rather than a macro.


--raidevnet
 
C

Cindy M.

Hi =?Utf-8?B?cmFpZGV2bmV0?=,
My solution is a Word 2007 add-in with custom buttons in the ribbon.
The users want to access some functionality provided by the add-in from a
context menu.
I've found article that describes how do do this in VBA.
http://gregmaxey.mvps.org/Customize_Word2007_SC_Menu_Programatically.htm

'Identify the module and procedure to run
.OnAction = "MySCMacros.RunMyFavMacro"

Is it possible to follow the same idea in .NET and, is so, how can I specify
the handler in the add-in rather than a macro.
Yes, but you need to handle the CommandBarButton's Click event. OnAction can
only link to a VBA macro. You'll find an article on this in the VSTO
documentation. If this is a Shared Add-in, not a VSTO add-in, then you can't
use all the information in the VSTO documentation, but this bit is pretty
"neutral"

http://msdn.microsoft.com/en-us/library/0batekf4.aspx

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 :)
 
R

raidevnet

Thanks Cindy,

The article seems to describe what I want to do.
It is written for Word 2003, but I will try to implement the solution with
Word 2007 and VSTO 3.0.

Rai
 
C

Cindy M.

The article seems to describe what I want to do.
It is written for Word 2003, but I will try to implement the solution with
Word 2007 and VSTO 3.0.
Shouldn't be a problem - the object model hasn't changed in this respect
between the two versions.

If you're using VSTO, then you might find the VSTO forum more helpful for
things related to your Add-in (vs. Questions concerning how Word actually
functions)
http://forums.microsoft.com/msdn/showforum.aspx?
forumid=16&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=0

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 :)
 

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