PDA

View Full Version : Email Thread



jaden
04-02-2013, 05:32 PM
Hi,

I am trying to create a macro to copy the last thread of an email to the clipboard. I have a macro that copies the entire email selected in the inbox to the clipboard but I need to trim that to the last thread (hopefully from inbox and not having to open it).

I have done some searching but have not found and good way to do this, any suggestions appreciated.

thank you.

skatonni
04-04-2013, 07:22 PM
Try something like this


Sub MostRecent()
Dim intOldmsgstart As Long
Dim strThismsg As String
Dim Item As Object
Set Item = ActiveExplorer.Selection(1)

'intOldmsgstart = InStr(Item.Body, "-----Original Message-----")
' intOldmsgstart is the location of where old/re/fwd msg starts. Will be 0 if new msg

intOldmsgstart = InStr(Item.Body, "From: ")

If intOldmsgstart = 0 Then
strThismsg = Item.Body
Else
' strThismsg = Left(Item.Body, intOldmsgstart)
strThismsg = Left(Item.Body, intOldmsgstart - 1)
End If

Debug.Print strThismsg

End Sub