Outlook VBA extract text from custom flags
I am fairly new to MS Outlook 2016 VBA. I handle a considerable number of emails every day on a 24x7 basis. I keep on flagging emails with custom text to enable me to track emails and correlate each with the other.
Unfortunately, however, I do not understand as to how to write an Outlook VBA to extract emails that are flagged along with custom texts in each flagged email in a folder.
I could manage to follow VBA code available at VBA Express forum. The code is as follows:
Sub CountItems()
Dim objMainFolder As Outlook.folder
Dim lItemsCount As Long
'Select a folder
Set objMainFolder = Outlook.Application.Session.PickFolder
If objMainFolder Is Nothing Then
MsgBox "You choose select a valid folder!", vbExclamation + vbOKOnly, "Warning for Pick Folder"
Else
'Initialize the total count
lItemsCount = 0
Call LoopFolders(objMainFolder, lItemsCount)
End If
'Display a message for the total count
MsgBox "There are " & lItemsCount & " items in the " & objMainFolder.Name & " folder Including its subfolders.", vbInformation, "Count Items"
End Sub
Sub LoopFolders(ByVal objCurrentFolder As Outlook.folder, lCurrentItemsCount As Long)
Dim objSubfolder As Outlook.folder
lCurrentItemsCount = lCurrentItemsCount + objCurrentFolder.Items.Count
'Process all folders and subfolders recursively
If objCurrentFolder.Folders.Count Then
For Each objSubfolder In objCurrentFolder.Folders
Call LoopFolders(objSubfolder, lCurrentItemsCount)
Next
End If
End Sub
After running the code, I could understand that it displays the count of emails in a folder and its subfolders.
It would be very helpful if someone could please guide me to relevant documentation that can help me create VBA required.
Interestingly, I stumbled across this page which partially solves my problem. The question is titled "How do you access custom Follow-Up flag values (“Flag to…”) in Outlook 2016?"
The solution, from what I could understand, pivots around the Search Folder in Outlook mail client and setting custom view by All Mail fields and Follow Up Flag and then setting the condition of the latter to "is not empty". Grouping by "Follow Up Flag" ascending then displays the custom flags in groups for easy reference.
However, that still does not solve the problem of listing the custom flag values. Any pointers will be very helpful.
from Recent Questions - Stack Overflow https://ift.tt/3DB39hU
https://ift.tt/eA8V8J
Comments
Post a Comment