Hi there...Im trying to make a routine or function that acomplishes this:
if the user gets focus on a text box, and keypress a key (Lets say a dash (/)) with the keybord, the text box the user is focused on, change its height to 250.
Is there any way to acomplish this by not having to code sub's for 150 textboxes.
Ive been reading quite a bit of this issue...and as far as i got is this code with help of this thread thread222-1364428.
****************************************************
Dim sClip As String
Dim sObj As String
Dim sSub As String
Dim sOrig As String
Dim ctl As Control
Clipboard.Clear
sOrig = "Private Sub XXX_GotFocus()"
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
sObj = ctl.Name
sSub = Replace(sOrig, "XXX", ctl.Name)
sSub = sSub & vbCrLf & ctl.Name & ".Height = 250 " & vbCrLf & "End Sub" & vbCrLf & vbCrLf
sClip = sClip & sSub
End If
Next
Clipboard.SetText sClip
MsgBox "The code for all the textbox GotFocus events is in the Clipboard"
****************************************************
Ok so far looks great, but i just have the plaintext of the routines on the clipboard.....
Any suggestions? please
if the user gets focus on a text box, and keypress a key (Lets say a dash (/)) with the keybord, the text box the user is focused on, change its height to 250.
Is there any way to acomplish this by not having to code sub's for 150 textboxes.
Ive been reading quite a bit of this issue...and as far as i got is this code with help of this thread thread222-1364428.
****************************************************
Dim sClip As String
Dim sObj As String
Dim sSub As String
Dim sOrig As String
Dim ctl As Control
Clipboard.Clear
sOrig = "Private Sub XXX_GotFocus()"
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
sObj = ctl.Name
sSub = Replace(sOrig, "XXX", ctl.Name)
sSub = sSub & vbCrLf & ctl.Name & ".Height = 250 " & vbCrLf & "End Sub" & vbCrLf & vbCrLf
sClip = sClip & sSub
End If
Next
Clipboard.SetText sClip
MsgBox "The code for all the textbox GotFocus events is in the Clipboard"
****************************************************
Ok so far looks great, but i just have the plaintext of the routines on the clipboard.....
Any suggestions? please