Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB to send email via outlook to a distrobution list
Hi Paul
Use ..Recipients.Add "GroupName" See more tips here http://www.rondebruin.nl/mail/tips2.htm And code examples here http://www.rondebruin.nl/sendmail.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Paul Lambson" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB to send email via outlook to a distrobution list
Ron, thanks! the websites you listed are a great resource.
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB to send email via outlook to a distrobution list
I'm unable to bypass the security feature. I am using this line of
code .Display Application.Wait (Now + TimeValue("0:00:02")) Application.SendKeys ("%s"), False rather than a .send but the sendkeys are not working. and advise? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB to send email via outlook to a distrobution list
Yep
Text from the page Note: SendKeys is not always reliable and this will not work on every computer The S is from Send, if you not use a English version you must change this letter. This tip is not working for the SendMail examples in the first section on my mail page. Maybe it is working if you close the VBA editor See this page for other options http://www.rondebruin.nl/mail/prevent.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Paul Lambson" wrote in message ... I'm unable to bypass the security feature. I am using this line of code .Display Application.Wait (Now + TimeValue("0:00:02")) Application.SendKeys ("%s"), False rather than a .send but the sendkeys are not working. and advise? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Send a Sheet as body of Outlook Email | Excel Discussion (Misc queries) | |||
Send email with Outlook | Excel Programming | |||
send email macro with Outlook running | Excel Programming | |||
Send Range to Outlook and Email it | Excel Programming | |||
***** PLEASE HELP **** Send an email from Excel to outlook with an automatic macro | Excel Discussion (Misc queries) |