I have been using the desribed method for awhile, but my users have complained about inadvertently deleting desired text without recourse. So I have amended the function to copy the text to the clipboard (or alternately another dummy text field) so that the user can retrieve the old text with the control z function similiar to word's udo function though only good for one level
Private Sub txtFields_GotFocus(Index As Integer)
If defaultTextSelect Then
txtFields(Index).Text = Trim(txtFields(Index).Text)
txtFields(Index).SelStart = 0
txtFields(Index).SelLength = Len(txtFields(Index).Text)
End If
Clipboard.SetText txtFields(Index).Text
End Sub
Private Sub txtFields_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
Dim tmpText As String
Dim ShiftKey As Long
ShiftKey = Shift And 7
Select Case ShiftKey
Case 2 ' or vbCtrlMask
Select Case KeyCode
Case vbKeyZ
tmpText = txtFields(Index).Text
txtFields(Index).Text = Clipboard.GetText
Clipboard.SetText tmpText
End Select
End Select
End Sub
This alternates the text box with data prior to Ctrl-Z and data at got focus -- keeps my users happy.
DracoWiz