Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default CommandBarButton onClick

Hola Folks,

environment:
- Excel 2003, VBA, Add-In (XLA)

I have added several menuitems to the Excel menu during the
registration of an add-in. Is there a way to handle onclick events for
the menu items I have added?

Right now, each one of the menu items has a different onaction
subroutine that stores an ID specifying which button was clicked in a
global variable.

In the end, I'd like to hook all of the onclick events for the menu
items that I have added through a single function. Even if they all
have the same function set in their onAction properties, it doesn't
look like I have a method of determining which of the menu items was
clicked.
I'd like to be able to get a handle to the control / menu item and
evaluate whatever is stored in the tag property. The only way I know of
to do this is kludgy and most importantly, doesn't seem to work as
expected across sessions.

I hope this is clear enough to make sense because I'm very tired and
probably not communicating effectively.



-V-

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default CommandBarButton onClick

On each menu item, set the Parameter or Tag properies separately, and then
test them in the macro like so

With CommandBars.ActionControl
Select Case .Tag
Case "Val1": 'some actione
Case "Val2": 'some other action
Case Else: 'default action
End Select
End With

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

wrote in message
oups.com...
Hola Folks,

environment:
- Excel 2003, VBA, Add-In (XLA)

I have added several menuitems to the Excel menu during the
registration of an add-in. Is there a way to handle onclick events for
the menu items I have added?

Right now, each one of the menu items has a different onaction
subroutine that stores an ID specifying which button was clicked in a
global variable.

In the end, I'd like to hook all of the onclick events for the menu
items that I have added through a single function. Even if they all
have the same function set in their onAction properties, it doesn't
look like I have a method of determining which of the menu items was
clicked.
I'd like to be able to get a handle to the control / menu item and
evaluate whatever is stored in the tag property. The only way I know of
to do this is kludgy and most importantly, doesn't seem to work as
expected across sessions.

I hope this is clear enough to make sense because I'm very tired and
probably not communicating effectively.



-V-



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default CommandBarButton onClick

Hello Bob,

Thanx Bunches! The ActionControl Property did the trick.



-V-

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnClick [email protected] Excel Discussion (Misc queries) 1 August 31st 06 06:08 PM
OnClick event lilika Excel Programming 2 February 22nd 05 05:34 PM
onClick in Excel Nicole Excel Programming 3 January 25th 05 09:45 AM
Self deleting CommandBarButton possible? Bruno G. Excel Programming 2 January 11th 05 12:13 PM
range onclick? Dennis Excel Programming 2 November 23rd 03 07:34 PM


All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"