Results 1 to 2 of 2

Thread: [RESOLVED] Recursive sub... Im no good at em!

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Resolved [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:
    1. Private Sub PrintSubjects(oFLD As Outlook.MAPIFolder)
    2. For z = 1 To oFLD.Folders.Count
    3.     Set ssFld = oFLD.Folders(z)
    4.     For x = 1 To ssFld.Items.Count
    5.         If TypeOf ssFld.Items(x) Is MailItem Then
    6.             Set oMail = ssFld.Items(x)
    7.             Debug.Print ssFld.Name & ": " & oMail.Subject
    8.         End If
    9.     Next
    10. Next
    11. End Sub

    thanks!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Recursive sub... Im no good at em!

    ooops thats twice now I have gotten ahead of myself!

    VB Code:
    1. Private Sub PrintSubjects(oFLD As Outlook.MAPIFolder)
    2.     For x = 1 To oFLD.Items.Count
    3.         If TypeOf oFLD.Items(x) Is MailItem Then
    4.             Set oMail = oFLD.Items(x)
    5.             Debug.Print oFLD.Name & ": " & oMail.Subject
    6.             'Print #1, oFLD.Name & ": " & oMail.Subject
    7.         End If
    8.     Next
    9.     For x = 1 To oFLD.Folders.Count
    10.         PrintSubjects oFLD.Folders(x)
    11.     Next
    12. End Sub

    seems to work! thank anyway (again!)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width