A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Adding Distribution list to an e-mail with multiple mailboxes



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 17th 07, 01:56 PM posted to microsoft.public.outlook.program_vba
Jamie
external usenet poster
 
Posts: 1
Default Adding Distribution list to an e-mail with multiple mailboxes

Hi

I'm fairly new to VB so please bear with me if my methods are obscure!

At work I have my own inbox and a shared mailbox which contains some
group distribution lists. I'm trying to create a Macro that sends an e-
mail to one of these distribtions lists, however, I'm struggling to
add it to my e-mail.

So far, I've tried the following piece of code...

Dim myRecipient As DistListItem
Set myRecipient = GetNamespace("MAPI").Folders.Item("Mailbox -
Nimrod_operations_Team_mail (UK)").Folders.Item("Distribution
Lists").Items("Test Distribution")
With Application.CreateItem(olMailItem)
.Recipients.Add (myRecipient)
.Recipients.ResolveAll
.Save
.Display
End With

Yet, all this does is add the text 'Test Distribution' to the e-mail
To: box and doesn't recognise it as a distribution list.

Where do I go from here?

Regards

Jamie

Ads
  #2  
Old May 20th 07, 10:13 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Adding Distribution list to an e-mail with multiple mailboxes

That approach won't work unless you've added the shared mailbox's Distribution Lists folder to the your own Outlook Address Book (a rather involved process), because Outlook cannot resolve the DL.

What you should be able to do, though, is use the DistListItem.GetMember method to iterate the DL's members and add each individual address to the message.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Jamie" wrote in message ups.com...
Hi

I'm fairly new to VB so please bear with me if my methods are obscure!

At work I have my own inbox and a shared mailbox which contains some
group distribution lists. I'm trying to create a Macro that sends an e-
mail to one of these distribtions lists, however, I'm struggling to
add it to my e-mail.

So far, I've tried the following piece of code...

Dim myRecipient As DistListItem
Set myRecipient = GetNamespace("MAPI").Folders.Item("Mailbox -
Nimrod_operations_Team_mail (UK)").Folders.Item("Distribution
Lists").Items("Test Distribution")
With Application.CreateItem(olMailItem)
.Recipients.Add (myRecipient)
.Recipients.ResolveAll
.Save
.Display
End With

Yet, all this does is add the text 'Test Distribution' to the e-mail
To: box and doesn't recognise it as a distribution list.

Where do I go from here?

Regards

Jamie

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding CC and BCC to distribution list Rick Outlook - Using Contacts 1 March 1st 07 10:02 AM
Adding a contact to one or multiple distribution lists Andy E Outlook - Using Contacts 4 December 28th 06 07:21 PM
Reminders List - Multiple Mailboxes George Outlook - Calandaring 7 August 31st 06 11:40 PM
Adding mutliple distribution lists into a distribution list? Abel Outlook - Using Contacts 2 August 30th 06 05:51 PM
Adding Members to a Distribution List DeeW Outlook - Using Contacts 2 January 24th 06 08:20 PM


All times are GMT +1. The time now is 03:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.