ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to access programatically added controls (https://www.excelbanter.com/excel-programming/306336-how-access-programatically-added-controls.html)

don bowyer

how to access programatically added controls
 
I have a UF to which some code adds a CommandButton in
runtime. No problem. But in design mode, by defenition,
the added control doesn't exist. So where do I put code to
recognise and act upon its click event. I've run out of
inspired guesses. Any help would be appreciated.
Don

Dave Peterson[_3_]

how to access programatically added controls
 
John Walkenbach has an example using OptionButtons at:
http://j-walk.com/ss/excel/tips/tip76.htm

But as an alternative, couldn't you design your form with that button already on
there--just have it not visible. Then when/if you need it, show it. (seems
much easier to me).

don bowyer wrote:

I have a UF to which some code adds a CommandButton in
runtime. No problem. But in design mode, by defenition,
the added control doesn't exist. So where do I put code to
recognise and act upon its click event. I've run out of
inspired guesses. Any help would be appreciated.
Don


--

Dave Peterson


Jim Cone

how to access programatically added controls
 
Don,

Might be easier to add the control and its code during design and set the visible property to false.
Then when you want to use the control, set its visible property to true.

Regards,
Jim Cone
San Francisco, CA

"don bowyer" wrote in message ...
I have a UF to which some code adds a CommandButton in
runtime. No problem. But in design mode, by defenition,
the added control doesn't exist. So where do I put code to
recognise and act upon its click event. I've run out of
inspired guesses. Any help would be appreciated.
Don


donbowyer[_2_]

how to access programatically added controls
 
Thanks to both Dave & Jim. That is the conclusion I came
to - keep it simple! I will look at John's site for
OptionButtons though. Cheers
Don
-----Original Message-----
John Walkenbach has an example using OptionButtons at:
http://j-walk.com/ss/excel/tips/tip76.htm

But as an alternative, couldn't you design your form with

that button already on
there--just have it not visible. Then when/if you need

it, show it. (seems
much easier to me).

don bowyer wrote:

I have a UF to which some code adds a CommandButton in
runtime. No problem. But in design mode, by defenition,
the added control doesn't exist. So where do I put code

to
recognise and act upon its click event. I've run out of
inspired guesses. Any help would be appreciated.
Don


--

Dave Peterson

.



All times are GMT +1. The time now is 08:30 AM.

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