Outlook VBA: Add to Distribution List

dhancy

Board Regular
Joined
Jul 10, 2013
Messages
123
Office Version
  1. 365
Platform
  1. Windows
I am so glad this site allows questions on other applications too. It's been super helpful with Excel, but now I have questions about Outlook VBA as well.

I have many questions, but for starters, I am trying to add email address to (and delete from) to distribution list in the GAL.

The code snippet here successfully finds my distribution list and prints all the members:

VBA Code:
Dim olEntry As Outlook.AddressEntry
Dim olDL As Outlook.ExchangeDistributionList
Dim i As Long

Set olEntry = Application.Session.GetGlobalAddressList.AddressEntries("XYZ")
Set olDL = olEntry.GetExchangeDistributionList

For i = 1 To olEntry.Members.Count
    Debug.Print olDL.Members.Item(i), olEntry.Members.Item(i).GetExchangeUser.PrimarySmtpAddress
Next i


But how do I add to this list (or delete from it)? I have searched online but haven't found anything of value yet.

Thanks for your help!


Dennis
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,223,636
Messages
6,173,485
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top