Hello again
I've trying to make a function that I can call that will make the existing text in a textbox be highlighted whenever the textbox gets focus... rather than copying the .selstart code over and over for every box's GotFocus.
I've never made a function with a variable like this before, so of course I'm having problems![]()
I've got this in the module:
And am using it in each textbox's GotFocus like:Code:Public Function HighLightIt(TextBoxName As Object) With TextBoxName .SelStart = 0 .SelLength = Len(.Text) End With End Function
HighLightIt(txtFirstName)
I keep getting "Compile Error: Type Mismatch" when trying to run it. I've tried TextBoxName as Control, Object and Textbox.
I'm sure someone sees what I'm doing wrong... please tell me :P
Thanks![]()





Reply With Quote