Public WithEvents App As Word.Application
Public ToPreview As Boolean

Private Sub ClearCursorPreview()
  If (Selection.Start > 1) And (Selection.End < ActiveDocument.Characters.Count - 1) Then
    Selection.Start = Selection.Start - 2 '
    Selection.End = Selection.End + 2 '
    Selection.Range.HighlightColorIndex = wdNoHighlight ' clear
    Selection.Start = Selection.Start + 2 '
    Selection.End = Selection.End - 2 '
  End If
End Sub

Private Sub ShowCursorPreview()
  If (Selection.Start > 1) And (Selection.End < ActiveDocument.Characters.Count - 1) Then
    Selection.Start = Selection.Start - 1
    Selection.Range.HighlightColorIndex = wdBrightGreen '
    Selection.Start = Selection.Start + 1
    Selection.End = Selection.End + 1 '
    Selection.Range.HighlightColorIndex = wdTurquoise '
    Selection.End = Selection.End - 1
  End If
End Sub

Private Sub AdaptCursor()
  Context = Selection.Characters(1).Text
  If Context = "" Then
    Beep
  ElseIf Asc(Context) = 63 Then ' Hebrew
    Application.Keyboard (1037)
  ElseIf (Context >= "A") And (Context <= "Z") Then
    Application.Keyboard (1033)
  ElseIf (Context >= "a") And (Context <= "z") Then
    Application.Keyboard (1033)
  ElseIf (Context >= "0") And (Context <= "9") Then
    Application.Keyboard (1033)
  End If
End Sub

Private Sub app_WindowSelectionChange _
        (ByVal Sel As Selection)
  SelLenght = Selection.End - Selection.Start
  If SelLenght = 0 Then
    AdaptCursor
    If ToPreview = True Then
      ClearCursorPreview
      ShowCursorPreview
    End If
  End If
End Sub

Private Sub app_WindowBeforeRightClick _
        (ByVal Sel As Selection, _
        Cancel As Boolean)
    If ToPreview = True Then
      ClearCursorPreview
      Cancel = True
    End If
End Sub 

