Hello,

I am using Outlook 2010 with Exchange 2010. I need to move all the "older" messages than 30 days from "Sent Items" to "Deleted Items".
Can you please let me know how i can achieve the above with VBA script?

The code below works fine to move messages from "Inbox" older than 30 days to "Old" folder.

Sub MoveOlderItems()
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objSourceFolder As Outlook.MAPIFolder
Dim objDestFolder As Outlook.MAPIFolder
Dim objVariant As Variant
Dim lngMovedItems As Long
Dim intCount As Integer
Dim intDateDiff As Integer
Dim strDestFolder As String
Set objOutlook = Application
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objSourceFolder = objNamespace.GetDefaultFolder(olFolderInbox)
' use your datafile name and each folder in the path
Set objDestFolder = objNamespace.Folders("gg@bb.com"). _
Folders("Inbox").Folders("Old")
For intCount = objSourceFolder.Items.Count To 1 Step -1
Set objVariant = objSourceFolder.Items.Item(intCount)
DoEvents
If objVariant.Class = olMail Then
intDateDiff = DateDiff("d", objVariant.SentOn, Now)
' I'm using 30 days, adjust as needed.
If intDateDiff > 30 Then
objVariant.Move objDestFolder
'count the # of items moved
lngMovedItems = lngMovedItems + 1
End If
End If
Next
' Display the number of items that were moved.
MsgBox "Moved " & lngMovedItems & " messages(s)."
Set objDestFolder = Nothing
End Sub

Can it be modified to achieve what i am trying to do?

Thank you for your input.