Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Common routine for many menu buttons

Hello,
I have 20 ControlButtons on a CommandBar, and the actions are similar,
but a parameter is needed. So I could brute force with 20 routines:
CBControl1.OnAction = "Do1"
CBControl2.OnAction = "Do2"
etc.
Sub Do1()
Call DoAll(1) ' common routine
End Sub
Sub Do2()
Call DoAll(2) ' common routine
End Sub
etc.

Is there a way for a DoAll routine to get the tag or the parameter
from the menu button that was pushed? How does one use
CBControl.Parameter?

TIA, Dave


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Common routine for many menu buttons

Try this technique from John Walkenbach's site:

http://www.j-walk.com/ss/excel/tips/tip44.htm

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Dave D-C" wrote in message
...
Hello,
I have 20 ControlButtons on a CommandBar, and the actions are similar,
but a parameter is needed. So I could brute force with 20 routines:
CBControl1.OnAction = "Do1"
CBControl2.OnAction = "Do2"
etc.
Sub Do1()
Call DoAll(1) ' common routine
End Sub
Sub Do2()
Call DoAll(2) ' common routine
End Sub
etc.

Is there a way for a DoAll routine to get the tag or the parameter
from the menu button that was pushed? How does one use
CBControl.Parameter?

TIA, Dave


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet
News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption
=----



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
Adding buttons to a new menu bar Greegan Excel Worksheet Functions 1 April 7th 06 07:55 AM
Fast Fourier Transform routine in Tools add-in menu Tutorguy Excel Worksheet Functions 1 March 23rd 06 04:49 PM
Common routine to handle a check box Mike News Excel Programming 3 February 21st 06 10:18 AM
Regarding Menu buttons Prathap Adusumilli Excel Programming 1 May 17th 04 11:22 PM
Disable Menu and command buttons Tom Ogilvy Excel Programming 0 July 14th 03 01:55 PM


All times are GMT +1. The time now is 10:37 AM.

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"