I have a very long email here that resulted from a series of Replies between me and a colleague. I now need to keep it for future reference. However, I wanted to remove all the email header blocks. Each one starts with "----" and is 5 lines long. Is there some way to do this?
Below is the code I have so far, but I don't know how to assign a string from the document, so the lines starting with "curLine = " won't let it compile.
How is assignment done?
Thanks.
Code
Sub clearEmailHeaders()
Dim curLine As String
curLine = Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
Do While (curLine <> "Stop")
If curLine = "----" Then
Selection.MoveDown Unit:=wdLine, Count:=4, Extend:=wdExtend
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="--------------------------------"
End If
Selection.TypeParagraph
curLine = Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
Loop
End Sub
Display More