Prior to Outlook 2013, I was able to access emails that were diverted to a sub folder of the InBox. Code was
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox) ' Inbox folder
Set mySubFolder(2) = myFolder.Folders("PHY2049") ' Inbox subfolder containing files
Set mySubFolder(1) = myFolder.Folders("PHY2048") ' Inbox subfolder containing files
Set mySelection = myOlApp.ActiveExplorer.Selection
Now I get as object error at Set mySubFolder(2)=..... I have 3 email accounts being controlled by Outlook. So I tried the following code assuming I correctly set the default account with the statement:
Set oAccount = myOlApp.Session.Accounts.Item(2)
Dim oAccount As Outlook.Account
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set oAccount = myOlApp.Session.Accounts.Item(2) '==
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox) ' Inbox folder
Set mySubFolder(2) = myFolder.Folders("PHY2049") '
Inbox subfolder containing files Same error. How do I code to define the subfolders of the oAccount?? Thanks Z
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox) ' Inbox folder
Set mySubFolder(2) = myFolder.Folders("PHY2049") ' Inbox subfolder containing files
Set mySubFolder(1) = myFolder.Folders("PHY2048") ' Inbox subfolder containing files
Set mySelection = myOlApp.ActiveExplorer.Selection
Now I get as object error at Set mySubFolder(2)=..... I have 3 email accounts being controlled by Outlook. So I tried the following code assuming I correctly set the default account with the statement:
Set oAccount = myOlApp.Session.Accounts.Item(2)
Dim oAccount As Outlook.Account
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set oAccount = myOlApp.Session.Accounts.Item(2) '==
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox) ' Inbox folder
Set mySubFolder(2) = myFolder.Folders("PHY2049") '
Inbox subfolder containing files Same error. How do I code to define the subfolders of the oAccount?? Thanks Z