I have below ReplyAll mail code, during running this code I am facing the following error:
Compile Error- User-Defined Type Not Defined
I have Pasted below Code & Try to Run this one But getting Compile Error as described above.
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
reply-to-outlook-mail-from-excel I expect that this Macro Run without any Error.