Activities in Outlook

SMB

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
As most on this forum probably agree, it was a sad day when MS removed the activities tab. I recently can across this VBA code to create an activates search, run running it I get an error, see below in red. Is this repairable, made to work for o365?

I will also attempt to get Search for All Messages from Contact and Display in New Window working.

Thank you all in advance for your help and contributions.

Sub FindContactActivities()

'=================================================================
'Description: Outlook macro to find all items related to a contact
' similar to the Contact Activities feature.
'
' author : Robert Sparnaaij
' version: 1.0
' website: Reviving the Contact Activities feature in Outlook 2013 - HowTo-Outlook
'==================================================================


If Application.Session.DefaultStore.IsInstantSearchEnabled Then

Dim olkExplorer As Outlook.Explorer
Set olkExplorer = Application.Explorers.Add(Application.Session.GetDefaultFolder(olFolderInbox), olFolderDisplayNormal)

Dim oItem As Object
Set oItem = Application.ActiveInspector.CurrentItem

If oItem.Class = olContact Then
Dim myContact As Outlook.ContactItem
Set myContact = oItem

Dim myContactAddress As String
Dim myContactName As String

myContactAddress = myContact.Email1Address
myContactName = myContact.FullName


Dim olkFilter As String

'Linked Contacts
olkFilter = "contactnames:(" & Chr(34) & myContactAddress & Chr(34) & " OR " & Chr(34) & myContactName & Chr(34) & ")"

'From this contact
olkFilter = olkFilter & " OR " & "from:(" & Chr(34) & myContactAddress & Chr(34) & " OR " & Chr(34) & myContactName & Chr(34) & ")"

'To this contact
olkFilter = olkFilter & " OR " & "to:(" & Chr(34) & myContactAddress & Chr(34) & " OR " & Chr(34) & myContactName & Chr(34) & ")"


Call olkExplorer.Search(olkFilter, olSearchScopeAllOutlookItems)

Call olkExplorer.Display

Else

MsgBox "Please run this command from an opened Contact item.", vbExclamation, "Open a Contact item"

End If

Set olkExplorer = Nothing
Set myContact = Nothing

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" & _
vbNewLine & vbNewLine & _
"To troubleshoot Search Indexing see: " & vbNewLine & _
"Fixing Instant Search - MSOutlook.info", _
vbExclamation, "Search Indexing not enabled"

End If

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Do you have the message open our selected?

This works with a selected contact -
 

SMB

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
Diane,

Yes, thank you they both worked. I just needed to change the name of the macro (showing my novice-ness).

Do you know of a way to include tasks in these searches? I am trying to use tasks as opposed to the Journal.

I also notice I have companies in a tool I used from MapiLab, but they do to show in the folders list. That would be nice is they did.

I am trying to build the simple features I used from BCM into O365.

Thanks again for your help.

Stuart
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
The scope for that would be olSearchScopeAllOutlookItems but to/from field shouldn't work on the contact field (assuming you linked it to a contact). I'll see what needs changed to work on everything.
 
Similar threads
Thread starter Title Forum Replies Date
Werewolf Workaround for the missing Activities tab in Contact Folder Properties in Outlook 2010? Using Outlook 2
Diane Poremsky Outlook 2010 & Contact Activities Using Outlook 0
F Outlook 2010 Activities search finds nothing Using Outlook 4
J Outlook replacement options - contact journal activities lost Using Outlook 23
C Tracking Activities in Outlook Calendar Using Outlook 1
S Outlook 2010: How do you enable Contacts' Activities to search archive folders Using Outlook 6
R Outlook 2010 Contact Activities Using Outlook 14
N Moving communication history and activities from BCM to OUtlook BCM (Business Contact Manager) 2
N Moving contacts and activities from BCM to OUtlook BCM (Business Contact Manager) 4
N contact notepad 'style' getting changed after clicking and running Activities Using Outlook 2
P activities tab 2013 Using Outlook 1
J Cannot Find Activities 2010 Using Outlook 14
R Activities - Speeding up retrivel Using Outlook 1
J GoDaddy migrated to Office365 - Outlook Wont Add Account Exchange Server Administration 10
K Outlook 365 After migrating to Outlook 365, some contacts display in emails with prefixes Using Outlook 0
J Outlook Rules VBA Run a Script - Multiple Rules Outlook VBA and Custom Forms 0
Horsepower Cannot delete gmail in iPhone Outlook outbox Using Outlook 1
F Outlook 2019 Outlook 2019 Add and Sync to New computer Comcast server Using Outlook 2
M Understanding Outlook Identities Using Outlook 1
kburrows Outlook or Phone Combining Contacts? Using Outlook 0
P Outlook 2013 search no longer works Using Outlook 2
M Accessing ALL Outlook contact fields Outlook VBA and Custom Forms 3
C Outlook (desktop app for Microsoft365) restarts every time I save my VBA? Using Outlook 0
R MailTips and older Outlook versions Using Outlook 0
A iCloud Outlook Add In is causing Outlook 2021 to crash and got disabled Using Outlook 4
C How to import Outlook calendar? Using Outlook 0
HarvMan Outlook 365 loses "outlook.com" exchange server settings Using Outlook 1
HarvMan Outlook.com Account Using Outlook 3
D Office 365 Outlook desktop app prompts for all account passwords on startup Using Outlook 6
D Alerts in outlook Using Outlook 1
richardwing Auto forward email that is moves into a specific outlook folder Outlook VBA and Custom Forms 5
L Recommendations for Utility to Backup Outlook 365 Account Settings Using Outlook 2
J Recommendations for Outlook Duplicate Email Remover Using Outlook 6
O Outlook - How to embed font ? (If at all possible) Using Outlook 2
Z New minimum Outlook for Windows version requirements for Microsoft 365/Exchange Online Using Outlook.com accounts in Outlook 16
T How to configure Outlook for two users on a single Windows account Using Outlook 3
R Outlook 2021 Having problem setting up outlook 2021 with windows 11. I have 3 gmail accounts and I want the 3 gmail, emails to merge into the same outlook input. Using Outlook.com accounts in Outlook 0
e_a_g_l_e_p_i Outlook 2021 all appointments not showing in calendar Using Outlook 2
S Outlook 365 Can I change the possible range of highlighting colours when writing an Outlook email? Using Outlook 1
B Outlook 213 keeps crashing. I just found out there are DMP files. How can I tell Why? Using Outlook 2
H Outlook 2016 related mails in outlook Outlook VBA and Custom Forms 13
S Outlook 2021 Can you make emails from 3 word domains "safe" by entering top 2 word domain into Safe List in Outlook? Using Outlook 1
@ Outlook Using Outlook 2
kburrows Outlook 365 - Ribbon Customizations Disappear Using Outlook 0
D Wishlist How to use 'app password' in Outlook 2003 after Google pulled plug on "less secure apps" Using Outlook 2
L Restoring Outlook from backup pst file Using Outlook 5
e_a_g_l_e_p_i Kernel Outlook .pst viewer Using Outlook 3
L Outlook 365 Outlook not working on linux how to solve it Using Outlook.com accounts in Outlook 0
T Outlook 2019 Using Gmail aliases in Outlook Using Outlook 6
S ios outlook Using Outlook.com accounts in Outlook 0

Similar threads

Top