Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2015, 01:45 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Accessing emails in Outlook - can I specify a sub-folder? Windows 7 64bit Accessing emails in Outlook - can I specify a sub-folder? Office 2013
Advanced Beginner
Accessing emails in Outlook - can I specify a sub-folder?
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default Accessing emails in Outlook - can I specify a sub-folder?

Hi,

I have a macro accessing the emails in the Outlook_inbox and parsing them to identify a specific one and process it.
Currently, I'm using the constant > olFolderInbox < (corresponding to the nr. 6) to specify the Inbox.

=> Is there a way to specify another folder (in this case that would be a subfolder that we created in the Inbox?

Thanks a lot!

Best regards,

Officer_Bierschnitt
Reply With Quote
  #2  
Old 11-26-2015, 03:36 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Accessing emails in Outlook - can I specify a sub-folder? Windows 7 64bit Accessing emails in Outlook - can I specify a sub-folder? Office 2013
Advanced Beginner
Accessing emails in Outlook - can I specify a sub-folder?
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

Hi,

there is another problem leading back to this one: The guys in the dpt. where that macro is supposed to run all have two inboxes: The personal one and a team_inbox.
When I ran a code that I found online to test for the ID of Outlook_sessions and display it in a MsgBox, however, only one session was found. Thus, I cannot have them run the macro unless someone logs on to the team_account.
It would be much more practical, however, if I was able to specify that the macro should not search the personal inbox, but the team_inbox.
I just don't know how to find out the constant I have to use to do so.
Can anybody help me with that?
Thanks a lot!

Best regards,

Officer_Bierschnitt
Reply With Quote
  #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
  #4  
Old 12-01-2015, 03:54 PM
Graham Griggs Graham Griggs is offline Accessing emails in Outlook - can I specify a sub-folder? Windows 8 Accessing emails in Outlook - can I specify a sub-folder? Office 2013
Novice
 
Join Date: Dec 2015
Posts: 11
Graham Griggs is on a distinguished road
Default addressing folders

Cant see quite what you are trying to do, but attach the code and fixing it should be simple
Reply With Quote
Reply



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 11:44 PM.


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