View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default Text Box Enter and Exit Events

Try something like......

' at top of userform code module
Dim TextBefore As String


Private Sub TextBox1_Enter()
TextBefore = Trim(TextBox1.Value)
End Sub

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Trim(TextBox1.Value) = TextBefore Then
MsgBox "No Change"
Else
MsgBox "Changed"
End If
End Sub

Private Sub UserForm_Initialize()
TextBefore = Trim(TextBox1.Value)
End Sub

--

Regards,
Nigel




"dunnerca" wrote in message
...
I am writing code in which I want to check the text value of a text box
upon
the exit from a text box against the value that was there upon the Enter
event. I seem to be having a problem passing this variable from the Enter
event procedure to the Exit event procedure. Anything obvious I'm
missing?
Also, is there a better way to do what I'm trying?