Notify other ActiveX about custom menu item click in Word using Ad

A

Atit Purani

I am suppose to customize MS Word so that it can be used as Editor.

As per the requirements I need to add our custom menu and menu items
into MS Word 2003 standard menu. We have done this using Add-in
project created in Visual Basic 6.0 (E.g. "Test Menu" which will have 4 sub
items - Open, Save, Save As, Close)

Now we want that when user clicks any of these sub menu items, our Main
GUI control (Working with the System) should be notified about this
particular click, so that I can do further processing and update the database
(SQL Server 2000) accordingly.


Here are some of the details about my Add-in project:

1. I am using Office.CommandBarButton for declaring each click events.
(e.g.Public WithEvents mcmdBarMenuItemSave As Office.CommandBarButton)

I am getting the click event for each of the CommandBars
(e.g. Public Sub mcmdBarMenuItemSave_click)

2. I want to raise events in the main GUI Control for each click event(s)
called.

Or is there any other way for notifying the main GUI control regarding
which particular click event is called?

Any help will be greatly appreciated.

Thanks in advance.

Regards,

Atit
 
J

Jean-Guy Marcil

Atit Purani was telling us:
Atit Purani nous racontait que :
I am suppose to customize MS Word so that it can be used as Editor.

As per the requirements I need to add our custom menu and menu items
into MS Word 2003 standard menu. We have done this using Add-in
project created in Visual Basic 6.0 (E.g. "Test Menu" which will have
4 sub items - Open, Save, Save As, Close)

Now we want that when user clicks any of these sub menu items, our
Main
GUI control (Working with the System) should be notified about this
particular click, so that I can do further processing and update the
database (SQL Server 2000) accordingly.

Why don't you just associate a macro with each OnAction property, as in:

Dim MyCtrl_1 As CommandBarControl
Dim MyCtrl_2 As CommandBarControl

'Set each control to a relevant control first,
'e.g. to get your first sub-Item on the first control:
Set MyCtrl_1 = Application.CommandBars("MyCustomToolBar") _
.Controls(1).CommandBar.Controls(1)


'e.g. to get your second sub-Item on the first control:
Set MyCtrl_2 = Application.CommandBars("MyCustomToolBar") _
.Controls(1).CommandBar.Controls(2)

'To call a sub
MyCtrl_1.OnAction = "MySub"

'To call a COM Add-in
MyCtrl_2.OnAction = "!<FinanceAddIn>"



--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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