F
Florian Rosch
Hi,
I'm using the code below from Siegfried Weber in a few of my custom created
forms with OL 2000 (on EXC2000). It works perfectly when I need just one
name in the field, but now I need this code modified so that I can choose
more than one recipient. But as I'm not the programming crack, I don't know
how to change the code so that I can choose an undefined number of names
from the GAL.
Can someone help me please?
Thank you!
Florian
-----------------snip---------------------
Function GetOneNameViaCDO()
Const cdoE_USER_CANCEL = &H80040113
' start CDO session
Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False
On Error Resume Next
Set colCDORecips = objSession.AddressBook(, "Pick a Name", , , 1, "My
Choice")
If Err = 0 Then
If colCDORecips.Count <> 1 Then
MsgBox "Please choose exactly one name!.", , "Choose One Name"
Else
strName = colCDORecips.Item(1).AddressEntry.Name
If Err = 287 Then
' security block triggered
MsgBox "Outlook cannot return a name, because you clicked No on the
e-mail address access dialog. You need to try again and click Yes this
time.", ,"E-mail Address Access"
End If
End If
ElseIf Err = cdoE_USER_CANCEL Then
' user canceled the address book dialog -
' do nothing or provide a message to user
End If
GetOneNameViaCDO = strName
' release objects
objSession.Logoff
Set colCDORecips = Nothing
Set objSession = Nothing
End Function
Sub CommandButton1_Click()
Item.Userproperties("customNamefield") = GetOneNameViaCDO
End Sub
I'm using the code below from Siegfried Weber in a few of my custom created
forms with OL 2000 (on EXC2000). It works perfectly when I need just one
name in the field, but now I need this code modified so that I can choose
more than one recipient. But as I'm not the programming crack, I don't know
how to change the code so that I can choose an undefined number of names
from the GAL.
Can someone help me please?
Thank you!
Florian
-----------------snip---------------------
Function GetOneNameViaCDO()
Const cdoE_USER_CANCEL = &H80040113
' start CDO session
Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False
On Error Resume Next
Set colCDORecips = objSession.AddressBook(, "Pick a Name", , , 1, "My
Choice")
If Err = 0 Then
If colCDORecips.Count <> 1 Then
MsgBox "Please choose exactly one name!.", , "Choose One Name"
Else
strName = colCDORecips.Item(1).AddressEntry.Name
If Err = 287 Then
' security block triggered
MsgBox "Outlook cannot return a name, because you clicked No on the
e-mail address access dialog. You need to try again and click Yes this
time.", ,"E-mail Address Access"
End If
End If
ElseIf Err = cdoE_USER_CANCEL Then
' user canceled the address book dialog -
' do nothing or provide a message to user
End If
GetOneNameViaCDO = strName
' release objects
objSession.Logoff
Set colCDORecips = Nothing
Set objSession = Nothing
End Function
Sub CommandButton1_Click()
Item.Userproperties("customNamefield") = GetOneNameViaCDO
End Sub