![]() |
Module, create toolbar/handle clicks
Using Excel 2003, I'm trying to write a module that will dynamically create a toolbar and buttons when the workbook loads, destroy the toolbar when it's closed, and handle the clicking on the buttons on it. I have already written all the code for creating a toolbar and destroying the toolbar. What I'm struggling with is a way to handle the clicking of the command buttons on the toolbar. I know there's an "onAction" property that I can point to a macro, but I'd like my module to have a procedure called "HandleCMDClick" or something, and be able to handle the clicking of any button. I've already tried including a parameter at the end of the "onAction" property, i.e. "modToolbar.HandleCMDClick("Button1")", but that doesn't work; it doesn't recognize that as a call to "HandleCMDClick". Is there a way, in the "HandleCMDClick" procedure, that I can tell which button was clicked? Anyone have any insight they can lend? Thanks much. -- nullGumby ------------------------------------------------------------------------ nullGumby's Profile: http://www.excelforum.com/member.php...o&userid=36128 View this thread: http://www.excelforum.com/showthread...hreadid=559033 |
Module, create toolbar/handle clicks
use
Commandbars.ActionControl to get a reference to the control triggering the action. -- Regards, Tom Ogilvy "nullGumby" wrote: Using Excel 2003, I'm trying to write a module that will dynamically create a toolbar and buttons when the workbook loads, destroy the toolbar when it's closed, and handle the clicking on the buttons on it. I have already written all the code for creating a toolbar and destroying the toolbar. What I'm struggling with is a way to handle the clicking of the command buttons on the toolbar. I know there's an "onAction" property that I can point to a macro, but I'd like my module to have a procedure called "HandleCMDClick" or something, and be able to handle the clicking of any button. I've already tried including a parameter at the end of the "onAction" property, i.e. "modToolbar.HandleCMDClick("Button1")", but that doesn't work; it doesn't recognize that as a call to "HandleCMDClick". Is there a way, in the "HandleCMDClick" procedure, that I can tell which button was clicked? Anyone have any insight they can lend? Thanks much. -- nullGumby ------------------------------------------------------------------------ nullGumby's Profile: http://www.excelforum.com/member.php...o&userid=36128 View this thread: http://www.excelforum.com/showthread...hreadid=559033 |
Module, create toolbar/handle clicks
Tom Ogilvy, Works prefectly! Thanks a lot -- nullGumb ----------------------------------------------------------------------- nullGumby's Profile: http://www.excelforum.com/member.php...fo&userid=3612 View this thread: http://www.excelforum.com/showthread.php?threadid=55903 |
All times are GMT +1. The time now is 05:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com