SUBFOLDER OF A SUBFOLDER

Status
Not open for further replies.

SiSept

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
I have a macro that sorts and moves mail into a subfolders according to category. I now want subfolders within the subfolders but I don't know how to write the instruction to move the mail - in this case 1st subfolder is AGENDA 05 MANAGEMENT then 2nd subfolder of 1st subfolder is PROJECTS 5.2 JOB REDESIGN:

If InStr(objItem.Categories, "AGENDAS 05 MANAGEMENT") > 0 Then
Set MyItem = objItem.Copy
MyItem.Move FolderInbox.Folders("AGENDAS 05 MANAGEMENT")
cMAILS.Add objItem.EntryID
End If


If InStr(objItem.Categories, "PROJECTS 5.2 JOB REDESIGN") > 0 Then
Set MyItem = objItem.Copy
MyItem.Move FolderInbox.Folders("PROJECTS 5.2 JOB REDESIGN")
cMAILS.Add objItem.EntryID
End If

I get an error message on the second instruction
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
this should work -
MyItem.Move FolderInbox.Folders("AGENDAS 05 MANAGEMENT").Folders("PROJECTS 5.2 JOB REDESIGN")

but its best to avoid so many dots in the path - something like would be better - it also makes it easier if you have a lot of subfolders under the agenda folder.
Code:
set agendaFolder -= FolderInbox.Folders("AGENDAS 05 MANAGEMENT")

If InStr(objItem.Categories, "AGENDAS 05 MANAGEMENT") > 0 Then
Set MyItem = objItem.Copy
MyItem.Move agendaFolder 
cMAILS.Add objItem.EntryID
End If


If InStr(objItem.Categories, "PROJECTS 5.2 JOB REDESIGN") > 0 Then
Set MyItem = objItem.Copy
MyItem.Move agendaFolder.Folders("PROJECTS 5.2 JOB REDESIGN")
cMAILS.Add objItem.EntryID
End If
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
N Move emails of same conversation to same subfolder Using Outlook 6
D How to handle filing of emails from an Inbox Subfolder to a specific Public folder Using Outlook 1
S VBA Code to move mail items from search folder to inbox subfolder Outlook VBA and Custom Forms 4
N Move red and unflagged emails to subfolder Outlook VBA and Custom Forms 1
B Open a folder / subfolder of a PST in single click Outlook VBA and Custom Forms 4
L Any util add ons for navigating al mail subfolder Using Outlook 0
V Macro to open Public Folders subfolder? Outlook VBA and Custom Forms 1
T Unable to create contacts subfolder in EAS profile Using Outlook.com accounts in Outlook 6
M VBA code needed to move from Outlook 2010 subfolder to Symantec Vault subfolde Using Outlook 0
M How do I access a contact list subfolder in Outlook 2013? Using Outlook 5
O BCM 13 added leads to an outlook 13 contact subfolder BCM (Business Contact Manager) 1
K Save a received email in a mailbox subfolder which is the same as the @email Using Outlook 1
J Create new outlook task into task subfolder using vba Using Outlook 6
N Save new contact from inbox to contact subfolder in Outlook 2010 Using Outlook 1
R Subfolder problems Using Outlook 2
T How to View all Contacts regardless of Subfolder? Using Outlook 8
M Change the default processing of the Inbox and it's subfolder. Exchange Server Administration 1
S How to set a folder in inbox to receive email from specific account?__For example Inbox-Shanthu(subfolder) has to receive email from Email removed for Using Outlook 2
C Mailbox folders: How do I change folders from being a subfolder of InBox folder? Using Outlook 3
V New-MailboxImportRequest PST Subfolder issue Exchange Server Administration 0
D Missing Inbox subfolder in Office Outlook Using Outlook 2
S Subfolder access through root folder in MS Outlook2003 Using Outlook 4
P Copy Contacts in a Public Folder to a Local Contacts Subfolder Outlook VBA and Custom Forms 6
Similar threads























Top