Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Outlook Agent Script.......

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can someone tell me what's wrong with this function!
I really don't see it.

I get an error on the line " Set oField = oRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)"

Can anyone please help me!

Function IsInRecipients(Data, CheckParam)

Dim i
Dim oRecip
Dim oField
Dim v
Dim str

For i = 1 To oMsg.Recipients.Count
Set oRecip = oMsg.Recipients.Item(i)

If CheckParam = 1 Then
If LCase(oRecip.Name) = LCase(Data) Then
WriteDebugString "Name matches"
Set oRecip = Nothing
IsInRecipients = True
Exit Function
End If

ElseIf CheckParam = 2 Then

Set oField = oRecip.AddressEntry.Fields(CdoPR_EMS_AB_PROXY_ADDRESSES)

For Each v In oField.Value
If LCase(Right(v, Len(v)-InStr(v,":"))) = LCase(Data) Then
WriteDebugString "E-Mail address matches"
Set oField = Nothing
Set oRecip = Nothing
IsInRecipients = True
Exit Function
End If

Next

Set oField = Nothing

End If

Set oRecip = Nothing
Next
IsInRecipients = False
End Function

 
Change it to this:

Set oField = oRecip.AddressEntry.Fields("CdoPR_EMS_AB_PROXY_ADDRESSES")

When referencing the field by name, you need to put the name in quotes.

Good Luck :)

Mike Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top