LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default VB to send email via outlook to a distrobution list

I am trying to send an email from excel to a distrobution list in
outlook. Any nifty code out there?

I found this on a group but can't get it to work.

Const olFolderContacts = 10
sDistName = "Friends" 'set the distribution list name here

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Set colContacts = objNamespace.GetDefaultFolder
(olFolderContacts).Items
intCount = colContacts.Count

For i = 1 To intCount
If TypeName(colContacts.Item(i)) = "DistListItem" Then
Set objDistList = colContacts.Item(i)
sEmails = "";
If objDistList.DLName = sDistName Then
For j = 1 To objDistList.MemberCount
sEmails = sEmails & ";" & objDistList.GetMember
(j).Address
Next

'send the mail using the emails u got! ;-) enjoy
End If
End If
Next

Any help will be appreciated.

Thanks,
paul
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Send a Sheet as body of Outlook Email David Ackerman on cape cod Excel Discussion (Misc queries) 0 March 19th 10 03:11 PM
Send email with Outlook MagicMan Excel Programming 2 October 21st 08 05:53 PM
send email macro with Outlook running DaveH Excel Programming 0 May 22nd 08 06:14 PM
Send Range to Outlook and Email it markb Excel Programming 0 October 15th 07 06:05 PM
***** PLEASE HELP **** Send an email from Excel to outlook with an automatic macro SAM SEBAIHI Excel Discussion (Misc queries) 0 November 11th 06 08:17 AM


All times are GMT +1. The time now is 04:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"