Get the GAL in excel

J

Justin

I am attempting do the following:

1. Call the Outlook GAL from an Excel UserForm
2. Have the user type in the Contact in a ComboBox
3. Select the Excel cell from the 'RefEdit' Button and enter the Name

I have done this program by referencing the Outlook 'Contacts' Folder,
yet I really need to plug directly into the GAL

The GAL contains Thousands of Names


Thanks for any help

Justin
 
J

Justin

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
 

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