Hi Allen,
On reading your suggestion, I realized I should be using the OnKeyDown event.
The first Sub below is my incarnation, the second I found on the Web. They
both suffer from the same 'anamoly'. Both will insert spaces for a TAB press
anywhere in the memo field. As a test, I deleted spaces made by Tabbing,
then hit TAB again -- strangely, the new TAB worked, but then all the
previous Tabs were restored as well! Spooky! ? ! ?
Private Sub txtHelp_KeyDown(KeyCode As Integer, Shift As Integer)
Me!CkDirty = True
If KeyCode = vbKeyTab Then
KeyCode = 0
txtHelp = Left(txtHelp.Value, txtHelp.SelStart) & " " &
Mid(txtHelp.Value, txtHelp.SelStart + 1)
txtHelp.SelStart = txtHelp.SelStart + 4
End If
End Sub
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
Dim stFront As String
Dim stBack As String
Dim lPos As Long
If KeyCode = 9 and Shift = 0 Then
KeyCode = 0
lPos = Text0.SelStart
stFront = Left(Text0.Value, lPos)
stBack = Mid(Text0.Value, lPos + 1)
Text0.Value = stFront & Space(5) & IIf(Trim(stFront) = "", ".", "")
& stBack
Text0.SelStart = lPos + 5
If Trim(stFront) = "" then SendKeys "{del}"
End If
End Sub