Sue! - Error in your sample.

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
********************************************************
 
A

Atlas

Shy!!!!!

I'm using an english version, list separator ";", Italian locale.........try
to change something and let you know.

BTW, did you read the message :
http://groups.google.com/groups?hl=...l=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&scoring=d

What would you suggest to do?



If you're using a non-English installation of Outlook, SetColumns may be
looking for localized names. It's an area that isn't very well documented.
Also, if your regional settings use a different default delimiter than
comma -- say, a semicolon -- you'll need to substitute that.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm

Atlas said:
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
********************************************************
 
S

Sue Mosher [MVP]

I would go out and buy one of the existing anti-spam tools. It's not worth my time to try to reinvent the wheel.

Atlas said:
Shy!!!!!

I'm using an english version, list separator ";", Italian locale.........try
to change something and let you know.

BTW, did you read the message :
http://groups.google.com/groups?hl=...l=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&scoring=d

What would you suggest to do?



If you're using a non-English installation of Outlook, SetColumns may be
looking for localized names. It's an area that isn't very well documented.
Also, if your regional settings use a different default delimiter than
comma -- say, a semicolon -- you'll need to substitute that.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm

Atlas said:
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
********************************************************
 
G

George Hester

Well I'm inventing one. The idea is to not allow all Spam and only allow what you want. But the real issue is to destroy it forever. So what I need is the most ill-written Spam you can get your hands on. When I say ill-written I do not mean dirty words. I mean the most convoluted rendition of HTML you can find. Spammers that means you too. Send me any Spam you think will get by me. Well there is one..the geocities spam. That one you got me. I can still catch it I just can't figure out where you're going to..that'll come.

--
George Hester
__________________________________
I would go out and buy one of the existing anti-spam tools. It's not worth my time to try to reinvent the wheel.

Atlas said:
Shy!!!!!

I'm using an english version, list separator ";", Italian locale.........try
to change something and let you know.

BTW, did you read the message :
http://groups.google.com/groups?hl=...l=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&scoring=d

What would you suggest to do?



If you're using a non-English installation of Outlook, SetColumns may be
looking for localized names. It's an area that isn't very well documented.
Also, if your regional settings use a different default delimiter than
comma -- say, a semicolon -- you'll need to substitute that.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm

Atlas said:
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
********************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top