[RESOLVED] Recursive sub... Im no good at em!
Basically I need this to be recursive... so
Start a folder "A" that is passed in...
and loop through all Mailitems.. then do the same for each subfolder
this will get 1st level of subfolders..
VB Code:
Private Sub PrintSubjects(oFLD As Outlook.MAPIFolder)
For z = 1 To oFLD.Folders.Count
Set ssFld = oFLD.Folders(z)
For x = 1 To ssFld.Items.Count
If TypeOf ssFld.Items(x) Is MailItem Then
Set oMail = ssFld.Items(x)
Debug.Print ssFld.Name & ": " & oMail.Subject
End If
Next
Next
End Sub
thanks!
Re: Recursive sub... Im no good at em!
ooops thats twice now I have gotten ahead of myself!
VB Code:
Private Sub PrintSubjects(oFLD As Outlook.MAPIFolder)
For x = 1 To oFLD.Items.Count
If TypeOf oFLD.Items(x) Is MailItem Then
Set oMail = oFLD.Items(x)
Debug.Print oFLD.Name & ": " & oMail.Subject
'Print #1, oFLD.Name & ": " & oMail.Subject
End If
Next
For x = 1 To oFLD.Folders.Count
PrintSubjects oFLD.Folders(x)
Next
End Sub
seems to work! thank anyway (again!)