FindControl() - get menu item name

N

Nicu

Hello!

I know maybe this was expanded on other threads but I searched and didn't
find exactly what I need so if you know a thread or a forum where I can find
answers please redirect me.

I want to intercept the click and CTRL+SHIFT+S and CTRL+S in Microsoft Word.
For the start, how can I get the menu entry "Save As..." from the "File"
menu? Then I will attach an event for click and I think this should do the
trick for the mouse clicks, for keyboard input I need to search more.

Thanks in advance,
Nicu
 
N

Nicu

I'm using VSTO 2005 SE, Visual Studio 2005, .NET Framework 2.0 and Microsoft
Office 2003.
 
N

Nicu

Ok, so I finally got the menu item(I think :) ) using:

//...
private Office.CommandBarButton btnSaveAsDefault;

//...
btnSaveAsDefault =
(Office.CommandBarButton)app.CommandBars["File"].Controls["Save As..."];

But why doesn't work this piece of code, I mean, when I press Save As...
button, nothing happens:

btnSaveAsDefault.Click += new
Office._CommandBarButtonEvents_ClickEventHandler(btnSaveAsDefault_Click);
 
N

Nicu

Sigh... That didn't work. Anyone could help me please? So I just want to
access the Save As... button from the File menu in Word.

Thanks and looking forward in hearing from you.
Nicu
 
C

Cindy M.

Hi Nicu,
I want to intercept the click and CTRL+SHIFT+S and CTRL+S in Microsoft Word.

I'm using VSTO 2005 SE, Visual Studio 2005, .NET Framework 2.0 and Microsoft
Office 2003.
I'm afraid this is going to be a problem. Keyboard shortcuts can only be
intercepted using a VBA procedure - they can't be mapped to code in an outside
project. You also can't intercept the "click" events of built-in control
buttons.

About the best you can do for Office 2003 is to trap the BeforeSave event.

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

Nicu

Thank you for your reply!
I see, I will give it a try with the BeforeSave event then.

Regards,
Nicu
 

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