ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   emailing recipients from a list in Excel (https://www.excelbanter.com/excel-programming/278424-emailing-recipients-list-excel.html)

Jeff[_22_]

emailing recipients from a list in Excel
 
I have the code to e-mail a spreadsheet and/or a reference
of cells to multiple recipients if I list the recipients
in the code. (recipients = array:("user1", "user2"))

Is there a way to have the code reference the spreadsheet
for the list of names instead of having them hard coded?

Also, Is there a way to turn off the security prompt that
either Outlook or Excel displays when sending an email?
(You are about to send an e-mail, are you sure you want to
do this?)

Thanks in advance!!

zantor[_22_]

emailing recipients from a list in Excel
 
Hi Jeff,

The following macro will put all the contents of Column A in an Array
called Recipients:

Sub StoreRecipients()

Dim i As Integer
Dim Recipients() As Variant
i = 1

Do Until Cells(i, 1) = ""
ReDim Recipients(i)
Recipients(i) = Cells(i, 1)
i = i + 1
Loop

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Dick Kusleika

emailing recipients from a list in Excel
 
Jeff

I have the code to e-mail a spreadsheet and/or a reference
of cells to multiple recipients if I list the recipients
in the code. (recipients = array:("user1", "user2"))

Is there a way to have the code reference the spreadsheet
for the list of names instead of having them hard coded?


Dim olMi as MailItem
Dim cell as Range

For Each cell in Range("A1:A10")
olMi.Recipients.Add cell.Value
Next cell

Also, Is there a way to turn off the security prompt that
either Outlook or Excel displays when sending an email?
(You are about to send an e-mail, are you sure you want to
do this?)


See here

http://www.rondebruin.nl/sendmail.htm#Prevent

There is no good way, in my opinion, but at least you'll know.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.




All times are GMT +1. The time now is 09:56 PM.

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