Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 11-26-2015, 10:01 AM
charlesdh charlesdh is offline Accessing emails in Outlook - can I specify a sub-folder? Windows 7 32bit Accessing emails in Outlook - can I specify a sub-folder? Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

HI,
As before I don have Outlook. But, See if this code helps.

Code:
Sub launchpad()
 
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim MyFolder As Outlook.MAPIFolder
    On Error Resume Next
    
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    Set MyFolder = objNS.PickFolder
    Call ProcessFolder(MyFolder)
    Set objNS = Nothing
 
Set MyFolder = Nothing
Set olApp = Nothing
Set objNS = Nothing
 
End Sub
 
 
Sub ProcessFolder(StartFolder As MAPIFolder)
Dim objFolder As Outlook.MAPIFolder
Dim objItem As Object
Dim mai As mailitem
    On Error Resume Next
'    MsgBox StartFolder.Path, , "testing"
    
    ' process all the items in this folder
'    For Each objItem In StartFolder.Items
'        If TypeName(objItem) = "MailItem" Then
'            Set mai = objItem
'        End If
'    Next
        
    ' process all the subfolders of this folder
    For Each objFolder In StartFolder.Folders
        Call ProcessFolder(objFolder)
    Next
 
Set mai = Nothing
Set objFolder = Nothing
Set objItem = Nothing
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Junk folder missing emails since 2/24/2015 rasmasyean Outlook 0 03-03-2015 04:28 PM
Show emails stored in a system folder (drive) in outlook megatronixs Outlook 3 10-28-2014 10:47 PM
Accessing emails in Outlook - can I specify a sub-folder? Outlook VBA rule to search email attachements and move the emails into a folder genius7 Outlook 6 09-09-2014 07:01 AM
outlook "Unread Email" folder automaticaly reads then dissapears emails michaelrj9 Office 0 08-20-2010 03:59 PM
Accessing emails in Outlook - can I specify a sub-folder? Is someone accessing my emails? Bitbat Outlook 2 08-04-2010 04:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft