Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Events with diniamically added controls
Hi,
I have an application in VBA were I dinamically add several controls to a form. Im creating arrays of variables of type Control to access the added controls, for ex: Set ctrl_graph(i) = page_id.Controls.Add(add_chkbox_string, "ctrl_graph" & i) Now I need to add events to this controls, but I have encountered that 'WithEvents' doesnt work with arrays. How can I add events to this controls? Greetings Fernando |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Events with diniamically added controls
Take a look here - I think the technique used there will apply.
http://www.j-walk.com/ss/excel/tips/tip44.htm John Walkenbach's site. -- Regards, Tom Ogilvy "fernando" wrote in message ... Hi, I have an application in VBA were I dinamically add several controls to a form. Im creating arrays of variables of type Control to access the added controls, for ex: Set ctrl_graph(i) = page_id.Controls.Add(add_chkbox_string, "ctrl_graph" & i) Now I need to add events to this controls, but I have encountered that 'WithEvents' doesnt work with arrays. How can I add events to this controls? Greetings Fernando |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Events with diniamically added controls
Tom,
This code works fine, but only with comboboxes, im using also textboxes and checkboxes, if I define in the class module this: Public WithEvents ctrl As CheckBox I get "the object doesnt have automation events", hope the translation is ok. fernando "Tom Ogilvy" wrote: Take a look here - I think the technique used there will apply. http://www.j-walk.com/ss/excel/tips/tip44.htm John Walkenbach's site. -- Regards, Tom Ogilvy "fernando" wrote in message ... Hi, I have an application in VBA were I dinamically add several controls to a form. Im creating arrays of variables of type Control to access the added controls, for ex: Set ctrl_graph(i) = page_id.Controls.Add(add_chkbox_string, "ctrl_graph" & i) Now I need to add events to this controls, but I have encountered that 'WithEvents' doesnt work with arrays. How can I add events to this controls? Greetings Fernando |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Events with diniamically added controls
can the controls events, props and methods be 'inherited'?, for ex. top,
caption, setfocus, etc. "Tom Ogilvy" wrote: Take a look here - I think the technique used there will apply. http://www.j-walk.com/ss/excel/tips/tip44.htm John Walkenbach's site. -- Regards, Tom Ogilvy "fernando" wrote in message ... Hi, I have an application in VBA were I dinamically add several controls to a form. Im creating arrays of variables of type Control to access the added controls, for ex: Set ctrl_graph(i) = page_id.Controls.Add(add_chkbox_string, "ctrl_graph" & i) Now I need to add events to this controls, but I have encountered that 'WithEvents' doesnt work with arrays. How can I add events to this controls? Greetings Fernando |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Events with diniamically added controls
Finally got it!
"Tom Ogilvy" wrote: Take a look here - I think the technique used there will apply. http://www.j-walk.com/ss/excel/tips/tip44.htm John Walkenbach's site. -- Regards, Tom Ogilvy "fernando" wrote in message ... Hi, I have an application in VBA were I dinamically add several controls to a form. Im creating arrays of variables of type Control to access the added controls, for ex: Set ctrl_graph(i) = page_id.Controls.Add(add_chkbox_string, "ctrl_graph" & i) Now I need to add events to this controls, but I have encountered that 'WithEvents' doesnt work with arrays. How can I add events to this controls? Greetings Fernando |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Click events not working when added during runtime | Excel Programming | |||
Manipulate Controls added at runtime | Excel Programming | |||
add event to controls added in runtime | Excel Programming | |||
Event procedures for controls added with Controls.Add | Excel Programming | |||
how to access programatically added controls | Excel Programming |