dev.sutradhar1987
Member
Hi,
I am trying to find mails with the relevant Subject from the outlook and then "replytoall" with a given format in the Body.
I have used the following code for searching the mails.
Sub Test()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 1
For Each olMail In Fldr.Items
If InStr(olMail.Subject, "Application for Privilege Leave - Leave ID - Dev-PL-45252-4") <> 0 Then
olMail.Display
i = i + 1
End If
Next olMail
End Sub
This is working. With this i am able to search and display the desired mail. Now what i need is to Replyall with the same subject and a prescribed body and signature.
It is similar to when we open up an mail in outlook and click on the Reply to All button.
I want it to get triggered from excel.
Could anyone help me with this please..
I am trying to find mails with the relevant Subject from the outlook and then "replytoall" with a given format in the Body.
I have used the following code for searching the mails.
Sub Test()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 1
For Each olMail In Fldr.Items
If InStr(olMail.Subject, "Application for Privilege Leave - Leave ID - Dev-PL-45252-4") <> 0 Then
olMail.Display
i = i + 1
End If
Next olMail
End Sub
This is working. With this i am able to search and display the desired mail. Now what i need is to Replyall with the same subject and a prescribed body and signature.
It is similar to when we open up an mail in outlook and click on the Reply to All button.
I want it to get triggered from excel.
Could anyone help me with this please..