Hi everyone - looking to accomplish a specific action in Outlook. Me: taught myself Batch and BASIC and took some C++ in college, but never went much further. So I understand programming, but struggle a bit with object oriented programming. The extent of my VBA is having created a UserForm to ask for some information and plug it into a form letter my office uses.
What I'd like to accomplish is simple conceptually ... while I have an email selected in the main/Mail pane, I'd like ... I want to execute a macro that:
1) finds a unique identifier in the subject field of the email; and then
2) searches the UID in subject/body in my Inbox and all subfolders (basic search, not Advanced).
Does the code really have to get into DASL/DAV Searching and Locating and MAPI?!
Outlook doesn't have a Record Macro function so the best I can even jump off with is a lame search macro from Word ... I'm sure this doesn't come close to the differences between searching an email vs of a Word document (for step 1), never mind the complexities of searching Outlook versus as opposed to one Word document. But I have to imagine the Search field in Outlook is an object that should make it simple enough?!?! (famous last words)
I've been in and out of dozens of Microsoft help pages and forums and finally decided to just ask.
Sub ForOutlook()
'
' ForOutlook Macro
'
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "<the UID would go here>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub