My document contains lot of blank spaces and paragraph marks.
What I want to do is detect if the Character Selection.find
is any letter from A to Z?
Dim EE As String
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^?"
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute
EE = Selection.Text
If isletter = True Then
MsgBox ("Letter found")
Else
MsgBox ("No letter found")
End If
Had done some research on paragraph mark and find out that Chr(13)
can detect ^p
(paragraph mark).
following code can detect paragraph mark
or Letter
.
Sub FindanyLetter()
Dim EE As String
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^?"
.Forward = False
.Wrap = wdFindStop
End With
Selection.Find.Execute
EE = Selection.Text
If EE = Chr(13) Or EE = " " Then
MsgBox "Paraghraph mark or space"
Else
MsgBox "Letter"
End If
End Sub