Patrick,
Yes, this is one way to do it. I haven't tested it extensively, but seems to work
Code:Sub ReplyMail_No_Movements() Dim olApp As Outlook.Application Dim olNs As NameSpace Dim Fldr As MAPIFolder Dim olMail As MailItem Dim objReplyToThisMail As MailItem Dim lngCount As Long Dim objConversation As Conversation Dim objTable As Table Dim objVar As Variant Set olApp = Session.Application Set olNs = olApp.GetNamespace("MAPI") Set Fldr = olNs.GetDefaultFolder(olFolderInbox) lngCount = 1 For Each olMail In Fldr.Items If InStr(olMail.Subject, "REQUEST FOR OVERTIME") <> 0 Then 'Text To Check Set objConversation = olMail.GetConversation Set objTable = objConversation.GetTable objVar = objTable.GetArray(objTable.GetRowCount) Set objReplyToThisMail = olApp.Session.GetItemFromID(objVar(UBound(objVar), 0)) With objReplyToThisMail.ReplyAll StrBody = "Hello " & "<br>" & _ "<p>Following up with the below. May you please advise?" & _ "<p>Thank you," & vbCrLf & vbCrLf & "<br>" & _ "<p>" & Session.CurrentUser.Name .HTMLBody = StrBody & .HTMLBody emailReady = True .Display End With Exit For End If Next olMail Set olApp = Nothing Set olNs = Nothing Set Fldr = Nothing Set olMail = Nothing Set objReplyToThisMail = Nothing lngCount = Empty Set objConversation = Nothing Set objTable = Nothing If IsArray(objVar) Then Erase objVar End Sub




Reply With Quote
Bookmarks