I want a VBA macro code for Outlook 2010 to move my manager requests mails from my inbox to another folder in case I reply.
Asked
Active
Viewed 191 times
0
-
3set up a rule instead. – Bathsheba Sep 10 '13 at 11:42
2 Answers
1
A rule really is the best solution for this, as @Bathsheba mentioned. Or, if you must do a VBA macro, I'd suggest recording a macro, then editing in VBA editor as required:
1. Click Tools, Macro.
2. Record macro.

Aaron Thomas
- 5,054
- 8
- 43
- 89
-
Thanx Aaron, actully i'm going to try recording it. but how can i differentiate the sender? – Mona Sep 10 '13 at 12:05
-
You may try checking [here](http://office.microsoft.com/client/helppreview.aspx?AssetId=HV808000379990&lcid=1033&NS=OUTLOOK%2EDEV&Version=12&respos=0&CTT=1&queryid=164e2982%2D6371%2D4ade%2Db9ba%2D1dc11a33ab5d) for more details. – Aaron Thomas Sep 10 '13 at 12:13
-
-
@enderland: At least some versions do have VBA macro recorder. My 2007 standard comes with it. Besides, the question was for VBA macro coding. – Aaron Thomas Sep 10 '13 at 18:15
1
The following code is the answer. Thanks to Graham Mayor www.gmayor.com
It checks for messages from strAddress in the default Inbox and those that have been replied to are moved to the sub folder of Inbox defined as strFolder - here 'Test'.
If you want to check all messages then remove the lines marked '*
Sub MoveReplied()
Dim olItems As Outlook.Items
Dim olItem As Outlook.MailItem
Dim i As Long
Dim strFolder As String
Dim strAddress As String
strAddress = "someoneATsomewhere.com"
strFolder = "Test"
Set olItems = Session.GetDefaultFolder(olFolderInbox).Items
olItems.Sort "[Received]", True
For i = olItems.Count To 1 Step -1
Set olItem = olItems(i)
If olItem.SenderEmailAddress = strAddress Then '*****
If Not olItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003") = 0 Then
olItem.Move Session.GetDefaultFolder(olFolderInbox).folders(strFolder)
End If
End If '*****
Next i
Cleanup:
Set olItems = Nothing
Set olItem = Nothing
End Sub
Best regards =)

Mona
- 21
- 6