Word 2010 (just starting VBA coding)
Word Document First Paragraph has 20 spaces and a paragraph sign; I would like to delete this paragraph under VBA control.
My code:
Dim MyText as String
Set MyRangePP = ActiveDocument.Range(Start:=ActiveDocument.Paragraphs(1).Range.Start, _
End:=ActiveDocument.Paragraphs(1).Range.End)
MyText = MyRangePP.Text
If MyText = " " Then
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
End If
A breakpoint is placed on the
If MyText = " " Then
statement.
I examine the value of MyText and it displays " " in the popup window as expected.
However, the statements within the If - End If block are not executed.
Any guidance would be very much appreciated.
Thanks...