A
Atlas
Cut and paste from
http://www.slipstick.com/dev/code/findemailaddy.htm
I get the error:
"Runtime error -xyxyyxyxyxyx, (xsxsxsxs)
The property ""Email1Address, Email2Address, Email3Address" is unknown."
The offending instruction is :
colItems.SetColumns ("Email1Address, Email2Address, Email3Address")
Any hint
********************************************************
Sub FindEmailAddressInContacts()
Dim objApp As Application
Dim objNS As NameSpace
Dim objContacts As MAPIFolder
Dim colItems As Items
Dim objItem As Object
Dim strAddress As String
Dim strWhere As String
Dim blnFound As Boolean
' get folder to search
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
strWhere = "[Email1Address] <> vbNullString " & "Or [Email2Address] <>
vbNullString " & "Or [Email3Address] <> vbNullString "
Set colItems = objContacts.Items.Restrict(strWhere)
' get address to search for
strAddress = InputBox("Find an Address in Contacts")
If strAddress <> "" Then
colItems.SetColumns ("Email1Address, Email2Address, Email3Address")
For Each objItem In colItems
' must test for item type to avoid distribution lists
If TypeName(objItem) = "ContactItem" Then
If InStr(objItem.Email1Address, strAddress) > 0 Then
objItem.Display
blnFound = True
Exit For
ElseIf InStr(objItem.Email2Address, strAddress) > 0 Then
objItem.Display
blnFound = True
Exit For
ElseIf InStr(objItem.Email3Address, strAddress) > 0 Then
objItem.Display
blnFound = True
Exit For
End If
End If
Next
End If
If Not blnFound Then
MsgBox "Not Found"
End If
Set objItem = Nothing
Set colItems = Nothing
Set objContacts = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub
********************************************************
http://www.slipstick.com/dev/code/findemailaddy.htm
I get the error:
"Runtime error -xyxyyxyxyxyx, (xsxsxsxs)
The property ""Email1Address, Email2Address, Email3Address" is unknown."
The offending instruction is :
colItems.SetColumns ("Email1Address, Email2Address, Email3Address")
Any hint
********************************************************
Sub FindEmailAddressInContacts()
Dim objApp As Application
Dim objNS As NameSpace
Dim objContacts As MAPIFolder
Dim colItems As Items
Dim objItem As Object
Dim strAddress As String
Dim strWhere As String
Dim blnFound As Boolean
' get folder to search
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objContacts = objNS.GetDefaultFolder(olFolderContacts)
strWhere = "[Email1Address] <> vbNullString " & "Or [Email2Address] <>
vbNullString " & "Or [Email3Address] <> vbNullString "
Set colItems = objContacts.Items.Restrict(strWhere)
' get address to search for
strAddress = InputBox("Find an Address in Contacts")
If strAddress <> "" Then
colItems.SetColumns ("Email1Address, Email2Address, Email3Address")
For Each objItem In colItems
' must test for item type to avoid distribution lists
If TypeName(objItem) = "ContactItem" Then
If InStr(objItem.Email1Address, strAddress) > 0 Then
objItem.Display
blnFound = True
Exit For
ElseIf InStr(objItem.Email2Address, strAddress) > 0 Then
objItem.Display
blnFound = True
Exit For
ElseIf InStr(objItem.Email3Address, strAddress) > 0 Then
objItem.Display
blnFound = True
Exit For
End If
End If
Next
End If
If Not blnFound Then
MsgBox "Not Found"
End If
Set objItem = Nothing
Set colItems = Nothing
Set objContacts = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub
********************************************************