hyperchondriac
New Member
- Joined
- Jun 25, 2017
- Messages
- 16
I'm trying to do some operations on the emails in my Sent Items folder, so I'm using the following code (copied from elsewhere) to get the emails in the folder.
However, when I run the code it only picks up the emails that are stored on my computer. I have several more years of emails stored on the Exchange server. Is there any way to get VBA to access every email on the Exchange server?
I'd eventually like to do it on my Inbox and sub-folders too, so a generic solution would be great. Thank you!
VBA Code:
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set olFolder = olNs.GetDefaultFolder(olFolderSentMail)
For i = olFolder.Items.Count To 1 Step -1
'Do stuff
Next i
However, when I run the code it only picks up the emails that are stored on my computer. I have several more years of emails stored on the Exchange server. Is there any way to get VBA to access every email on the Exchange server?
I'd eventually like to do it on my Inbox and sub-folders too, so a generic solution would be great. Thank you!