View Single Post
 
Old 03-23-2018, 04:28 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You need to define strsubject e.g.

Code:
Dim strSubject As String 'this line already in macro
Dim oPara As Range
Dim lngPara As Long
    For lngPara = 1 To ActiveDocument.Paragraphs.Count
        Set oPara = ActiveDocument.Paragraphs(lngPara).Range
        If Left(LCase(oPara.Text), 3) = "re:" Then
            oPara.End = oPara.End - 1
            oPara.MoveStartUntil Chr(32)
            oPara.Start = oPara.Start + 1
            strSubject = oPara.Text
            Exit For
        End If
    Next lngPara
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote