Hi All -
I'm trying to implement the below macro to open up outlook and reply to specific emails but Excel isn't able to locate/recognize the macro. I've tried to save it in the relevant sheet and in a module but still doesn't show up for either. When I press F5 inside the macro it pulls up the screen prompting me to type the macro in (because it can't find it). I have the Outlook library enabled as well. Thanks!
I'm trying to implement the below macro to open up outlook and reply to specific emails but Excel isn't able to locate/recognize the macro. I've tried to save it in the relevant sheet and in a module but still doesn't show up for either. When I press F5 inside the macro it pulls up the screen prompting me to type the macro in (because it can't find it). I have the Outlook library enabled as well. Thanks!
VBA Code:
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