View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Justin[_9_] Justin[_9_] is offline
external usenet poster
 
Posts: 3
Default Get the GAL in excel

I found a SOLUTION...with some help from another board

BE SURE TO CHECK

TOOLS | REFERENCES | Microsoft CDO 1.21 Library




Public Sub GetAddressesViaCDO()

Dim oSession As New MAPI.Session
Dim colCDORecips As MAPI.Recipients
Dim objCDORecip As MAPI.Recipient
Dim sRecipTo As String
Dim sRecipCc As String
Dim sRecipBcc As String
Dim sType As String

'Start CDO session
' IF you are having problems here, switch both FALSE's to TRUE
oSession.Logon , , False, False

' show address book
Set colCDORecips = oSession.AddressBook(Title:="1. ENTER NAME _
2. PRESS SELECT 3.PRESS OK", _
forceresolution:=True, reciplists:=1, tolabel:="Select")

For Each objCDORecip In colCDORecips
If objCDORecip.Type = 1 Then
sRecipTo = sRecipTo & "" & objCDORecip.Name
End If
Next

'Enter Recipient into ActiveCELL

AddRecipsViaCDO = sRecipTo
oSession.Logoff
ActiveCell = AddRecipsViaCDO

'Free up Memory
Set colCDORecips = Nothing
Set objCDORecip = Nothing
Set oSession = Nothing

End Sub