ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamically Added Control (https://www.excelbanter.com/excel-programming/390445-dynamically-added-control.html)

Bobt

Dynamically Added Control
 
I am building a form that dynamically adds a frame and set of radio buttons.
The number and name of the buttons will vary depending on how many cells are
filled in. What I want to do is then add some code to these radio buttons at
run time.

How do you add code to a control that is added at run time? The code I want
to attach to the control will, obviously, be written at design time.

Thanks in advance.

Norman Jones

Dynamically Added Control
 
Hi Bob,

See the methods used by John Walkenbach at:

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



---
Regards,
Norman


"BobT" wrote in message
...
I am building a form that dynamically adds a frame and set of radio
buttons.
The number and name of the buttons will vary depending on how many cells
are
filled in. What I want to do is then add some code to these radio buttons
at
run time.

How do you add code to a control that is added at run time? The code I
want
to attach to the control will, obviously, be written at design time.

Thanks in advance.




Tom Ogilvy

Dynamically Added Control
 
Same site, but I would recommend this as an alternate approach:

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

Just be aware that it won't work with Events provided by the control object
such as Exit, Enter, BeforeUpdate, AfterUpdate - only those native to the
OptionButton.

--
Regards,
Tom Ogilvy



"Norman Jones" wrote:

Hi Bob,

See the methods used by John Walkenbach at:

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



---
Regards,
Norman


"BobT" wrote in message
...
I am building a form that dynamically adds a frame and set of radio
buttons.
The number and name of the buttons will vary depending on how many cells
are
filled in. What I want to do is then add some code to these radio buttons
at
run time.

How do you add code to a control that is added at run time? The code I
want
to attach to the control will, obviously, be written at design time.

Thanks in advance.





Dave Peterson

Dynamically Added Control
 
Have you thought about designing the userform for the worst case scenario?

Hide the buttons/frame/whatever. And only show what you need. Depending on
what you're doing, it may make your life a bit easier.

BobT wrote:

I am building a form that dynamically adds a frame and set of radio buttons.
The number and name of the buttons will vary depending on how many cells are
filled in. What I want to do is then add some code to these radio buttons at
run time.

How do you add code to a control that is added at run time? The code I want
to attach to the control will, obviously, be written at design time.

Thanks in advance.


--

Dave Peterson


All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com