You need to call the other code from it e.g. as follows. I have not tested the code, just made a couple of modifications to it to work with the folders derived from the Processfolders macro. It saves in a sub folder of Inbox called "Old" which must exist.
Option Explicit
'Graham Mayor - http://www.gmayor.com - Last updated - 31 Oct 2017
Sub Processfolders()
Dim cFolders As Collection
Dim olFolder As Outlook.Folder
Dim subFolder As Folder
Dim olNS As Outlook.NameSpace
Set cFolders = New Collection
Set olNS = GetNamespace("MAPI")
cFolders.Add olNS.PickFolder
Do While cFolders.Count > 0
Set olFolder = cFolders(1)
cFolders.Remove 1
'Do something here with olfolder e.g.
MoveAgedMail olFolder
For Each subFolder In olFolder.folders
cFolders.Add subFolder
DoEvents
Next subFolder
Loop
lbl_Exit:
Set olFolder = Nothing
Set subFolder = Nothing
Set olNS = Nothing
Exit Sub
End Sub
Sub MoveAgedMail(objSourceFolder As Outlook.MAPIFolder)
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
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")
'Tell the macro where to store the messages here a folder called "Old" under inbox
Set objDestFolder = objNamespace.GetDefaultFolder(olFolderInbox).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)
' Adjust days 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