I created thru you the macro that when I open up a contact and run the macro, it searches the calendar for the last name of the contact throughout the calendar.
But when I open the contact thru the shortcut (which we fixed just recently for the combobox macro), the macro for the calendar search does not run.
The macro you gave me was the folowing and the line : Set oContact = ActiveExplorer.Selection.Item(1): shows up yellow from the debug etc.
Any way to fix this one as well??
Thanks so much!!
Sub Search_Calender()
Dim myOlApp As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim strFilter As String
Dim oContact As Outlook.ContactItem
Set ns = myOlApp.GetNamespace("MAPI")
Set oContact = ActiveExplorer.Selection.Item(1)
' use oContact.FullName to search on the name
strFilter = oContact.LastName
Set myOlApp.ActiveExplorer.CurrentFolder = ns.GetDefaultFolder(olFolderCalendar)
txtSearch = strFilter
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub
But when I open the contact thru the shortcut (which we fixed just recently for the combobox macro), the macro for the calendar search does not run.
The macro you gave me was the folowing and the line : Set oContact = ActiveExplorer.Selection.Item(1): shows up yellow from the debug etc.
Any way to fix this one as well??
Thanks so much!!
Sub Search_Calender()
Dim myOlApp As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim strFilter As String
Dim oContact As Outlook.ContactItem
Set ns = myOlApp.GetNamespace("MAPI")
Set oContact = ActiveExplorer.Selection.Item(1)
' use oContact.FullName to search on the name
strFilter = oContact.LastName
Set myOlApp.ActiveExplorer.CurrentFolder = ns.GetDefaultFolder(olFolderCalendar)
txtSearch = strFilter
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub