Victor Beekman wanted to share another macro with our visitors. This is similar to our macros that search for all messages from a contact or sender but instead of doing an "in-place" search, it opens a new window with the results. The reading pane is turned off, the navigation pane is supposed to be turned off (it's left enable at times), while the To-Do Bar can't turned off.
To use, select a message or a contact then run the macro. A new Outlook windows will open, displaying only the message list pane with the search results.
Sub FindContactActivities() ' ================================================================= ' Description: Outlook macro to find all mails related to a contact ' author : Victor Beekman victor[dot]beekman"at"xs4all{dot}nl ' version: 1.1 160623 ' Note: the "to:" and "from:" should be localized in your own language. ' Please check the proper wording by using the instant search feature. '================================================================== If Application.Session.DefaultStore.IsInstantSearchEnabled Then Dim olkFilter As String Dim oItem As Object Dim olkExplorer As Outlook.Explorer If Application.ActiveExplorer.Selection.Count <> 1 Then MsgBox "Command works only for one selected item", vbExclamation Exit Sub End If Set oItem = Application.ActiveExplorer.Selection.Item(1) Set olkExplorer = Application.Explorers.Add(Application.Session.GetDefaultFolder(olFolderInbox), olFolderDisplayNormal) If oItem.Class = olContact Then olkFilter = "from:(" & Chr(34) & oItem.Email1Address & Chr(34) & ") OR " _ & " to:(" & Chr(34) & oItem.Email1Address & Chr(34) & ") OR " _ & "cc:(" & Chr(34) & oItem.Email1Address & Chr(34) & ")" If Len(oItem.Email2Address) > 5 Then olkFilter = olkFilter & " OR from:(" & Chr(34) & oItem.Email2Address & Chr(34) & ") OR " _ & " to:(" & Chr(34) & oItem.Email2Address & Chr(34) & ") OR " _ & "cc:(" & Chr(34) & oItem.Email2Address & Chr(34) & ")" End If ElseIf oItem.Class = olMail Then olkFilter = " from:(" & Chr(34) & oItem.SenderEmailAddress & Chr(34) & ") OR " _ & "to:(" & Chr(34) & oItem.SenderEmailAddress & Chr(34) & ") OR " _ & "cc:(" & Chr(34) & oItem.SenderEmailAddress & Chr(34) & ")" Else MsgBox "Command can't be run from here", vbExclamation Exit Sub End If Else MsgBox "Search Indexing is not enabled for this mailbox." & vbNewLine & vbNewLine & _ "If you are using an Exchange account, make sure that Cached Exchange Mode is enabled" & _ vbExclamation, "Search Indexing not enabled" Exit Sub End If Call olkExplorer.Search(olkFilter, olSearchScopeAllOutlookItems) Call olkExplorer.Display ' hide the navigation bar & preview pane olkExplorer.ShowPane olFolderList, False olkExplorer.ShowPane olOutlookBar, False olkExplorer.ShowPane olPreview, False olkExplorer.ShowPane olNavigationPane, False 'olkExplorer.ShowPane olToDoBar, False End Sub
How to Use Macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 and above, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, itâs at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor
An attorney I hired had a disagreement with me and I ended his services and now he has removed his information on my case from my Hotmail account. Can those replies be recovered and was he wrong removing his replies?
He can't remove his replies from your account unless he has your password. If the messages were removed and are not in the Deleted Items folder or Deleted Items recovery, then they can not be recovered from the server. Sorry.