LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign click functionality to dynamically created textboxes?


Hi all,

I have a userform that has textboxes that are created and populate
dynamically at runtime.

i.e.: based on the number of cells found to be populated with data o
a spreadsheet, I create a userform with textboxes with value
cooresponding to those cells

I want to add the ability to double click on these textboxes and hav
the value changed to the current date being displayed by a calande
control that is also built into my userform.

But since don't know how many textboxes are going to be created on
given execution of the code, I can't just make the subs that woul
normally control click actions.

Say there were 2 textboxes being created, I'd then need:

Sub Textbox1_dblclick(ByVal Cancel as MSForms.ReturnBoolean)
Textbox1 = calendar1
End sub
-----------------------------------
Sub Textbox2_dblclick(ByVal Cancel as MSForms.ReturnBoolean)
Textbox2 = calendar1
End sub

But if I have 5 textboxes, I'd need 5 subs. If 10, then 10. etc.

Is there any way to include a variable as part of a sub's name?

Like say:

Sub Controls("Textbox" & N)_dblClick(ByVal Cancel A
MSForms.ReturnBoolean)

with the value for N being passed by another procedure during th
intial building of the userform

--
Ouk
-----------------------------------------------------------------------
Ouka's Profile: http://www.excelforum.com/member.php...fo&userid=2398
View this thread: http://www.excelforum.com/showthread.php?threadid=39800

 
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
Change Single-Click Functionality? Wuddus Excel Discussion (Misc queries) 2 September 10th 07 11:54 AM
Scaling a chart that has been dynamically created in vb Mark Charts and Charting in Excel 3 May 27th 05 08:16 PM
Programming double click functionality Cyberindio Excel Programming 1 June 19th 04 10:13 AM
Assign macros to dynamically created form elements Joepy Excel Programming 4 March 3rd 04 09:03 PM
Program a combobox/dropdownlist to create textboxes dynamically ed Excel Programming 0 October 30th 03 09:02 PM


All times are GMT +1. The time now is 12:01 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"