Outlook VBA - Automatically select Approve

Jacki

New Member
Joined
Jul 27, 2014
Messages
17
Hello folks,

I am hoping someone out there might be able to help with this. I get a lot of emails everyday where I need to select the Approve button. The Approve button is a link to a generic email address and includes the request ID, which is unique for every email.

Is there a macro that will automatically select the approve button for each unread email and then mark the email as read?

Appreciate any help I can get on this!!

Thanks in advance

Jacki
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello Jacki

I do not have Outlook configured on this machine, so the code was not fully tested:


Code:
' Outlook module
Public Sub Example()
Dim olNs As NameSpace, Inbox As MAPIFolder, it As Items, i%, f$
Set olNs = Application.GetNamespace("MAPI")
Set Inbox = olNs.GetDefaultFolder(olFolderInbox)
f = "@SQL=" & Chr(34) & "urn:schemas:httpmail:read" & Chr(34) & "=0"
Set it = Inbox.Items.Restrict(f)
For i = it.Count To 1 Step -1               ' unread
    it(i).VotingResponse = "Approve"        ' vote
    it(i).UnRead = False                    ' mark as read
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top