Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Atit Purani - 26 Dec 2005 06:38 GMT
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
Jean-Guy Marcil - 28 Dec 2005 16:44 GMT
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.
>
[quoted text clipped - 8 lines]
> 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>"

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.