Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Help with adding controls

Hi, I just learned about adding controls to a userform through coding and it
seems very useful. However, i was wondering if it is possible to make the
controls added use _change functions?

For example, on my code i have a textbox added when a user clicks a button.
I name the textbox "Scan2"
I know i can access the data in the new textbox by using
userform1.controls("Scan2") However, i need to use a function that evaluates
each character entered into the box and wait's for a ctrl key (chr(10)) to
be pressed. When pressed, it runs a different function.

If i had hard coded the textbox, i would use

Private Sub Scan2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 17 Or KeyCode = 13 Then
call searchdata()
KeyCode = 0
End If

End Sub

any help would be great.

oh, i tried doing private sub homer.controls("scan2")_keydown...etc.. but of
course that didn't work. It's never that easy :)

Dan Butler







Reply
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
ActiveX Controls leerem Excel Discussion (Misc queries) 0 December 11th 08 01:11 PM
Need Help Tabbing between controls DSeabound Excel Discussion (Misc queries) 0 February 12th 08 05:25 PM
using gui controls daddy260 Excel Discussion (Misc queries) 4 May 25th 07 07:35 AM
Volatile Macro for Adding Controls When Opening Workbook Wuddus Excel Discussion (Misc queries) 6 August 10th 06 05:52 PM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"