0

How would I get a macro to run on the Inbox and any subfolders?

This only applies to the root folder

Set xInboxFld = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
braX
  • 11,506
  • 5
  • 20
  • 33
alieg
  • 1
  • `For Each Folder in xInboxFld` – jclasley Jan 30 '20 at 13:22
  • Does this answer your question? [Excel vba: Looping through all subfolders in Outlook email to find an email with certain subject](https://stackoverflow.com/questions/45346183/excel-vba-looping-through-all-subfolders-in-outlook-email-to-find-an-email-with) – ProfoundlyOblivious Jan 30 '20 at 13:25
  • This is how I have solved the problem: `Set xInboxFld = Outlook.Application.Session.GetDefaultFolder(olFolderInbox) Set xCurrentFld = Outlook.Application.ActiveExplorer.CurrentFolder If xCurrentFld.Parent = xInboxFld Then Set xInboxFld = xCurrentFld End If` – alieg Jan 31 '20 at 10:31

1 Answers1

-1
dim subFolder 
for each subFolder in xInboxFld.Folders
  MsgBox subFolder.Name
next
Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78