Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim bcmRootFolder As Outlook.Folder
Dim olFolders As Outlook.Folders
Dim bcmOppFolder As Outlook.Folder
Dim existOpportunity As Outlook.TaskItem
Set olApp = CreateObject("Outlook.Application")
Set objNS = olApp.GetNamespace("MAPI")
Set olFolders = objNS.Session.Folders
Set bcmRootFolder = olFolders("Business Contact Manager")
Set bcmOppFolder = bcmRootFolder.Folders("Opportunities")
Set existOpportunity = bcmOppFolder.Items.Find("[Subject] = 'Opportunity For Wide World Importers to enter into Retail Field'")
If Not TypeName(existOpportunity) = "Nothing" Then
If (existOpportunity.UserProperties("Sales Stage") Is Nothing) Then
Set userProp = existOpportunity.UserProperties.Add("Sales Stage", olText, False, False)
userProp.Value = "Prospecting"
Else
existOpportunity.ItemProperties("Sales Stage").Value = "Prospecting"
End If
existOpportunity.Save
Else
MsgBox ("Failed to find the Opportuntiy with Subject Opportunity For John Smith to take over the Spring Sales")
End If
Set existOpportunity = Nothing
Set bcmOppFolder = Nothing
Set bcmRootFolder = Nothing
Set olFolders = Nothing
Set objNS = Nothing
Set olApp = Nothing