ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get the GAL in excel (https://www.excelbanter.com/excel-programming/295847-get-gal-excel.html)

Justin[_9_]

Get the GAL in excel
 
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

Justin[_9_]

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


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com