Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default send email with email addresses in a range of cells

I'm trying to send a workbook to a list of email addresses within the
workbook. When I use ActiveWorkbook.SendMail and list the recipients
as values of cells withing the workbook, It's coming up with a 1004,
unkown recipient name in list of recipients. How would i format the
recipient section in the vb code to get rid of this error? Or is there
a better way to do this all together (other than
ActiveWorkbook.SendMail?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default send email with email addresses in a range of cells

Hi Graig

See
http://www.rondebruin.nl/mail/tips1.htm


Send to all E-mail addresses in a range
Dim MyArr As Variant
MyArr = Sheets("mysheet").Range("C1:C10")
..SendMail MyArr, "This is the Subject line"


Send only to the visible Addresses in column C
Dim rng As Range
Dim Arr() As String
Dim N As Integer
Dim cell As Range

Set rng = Sheets("Sheet1").Columns("C").Cells.SpecialCells(x lCellTypeConstants)
ReDim Preserve Arr(1 To rng.Cells.Count)
N = 0
For Each cell In rng
If cell.EntireRow.Hidden = False And cell.Value Like "*@*" Then
N = N + 1
Arr(N) = cell.Value
End If
Next cell
ReDim Preserve Arr(1 To N)

'Use this then in the SendMail line
.SendMail Arr, "This is the Subject line"


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Craig" wrote in message oups.com...
I'm trying to send a workbook to a list of email addresses within the
workbook. When I use ActiveWorkbook.SendMail and list the recipients
as values of cells withing the workbook, It's coming up with a 1004,
unkown recipient name in list of recipients. How would i format the
recipient section in the vb code to get rid of this error? Or is there
a better way to do this all together (other than
ActiveWorkbook.SendMail?



Reply
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
How to merge email addresses in excel with a document and send it? kjfussell Excel Discussion (Misc queries) 2 January 21st 09 10:29 PM
Send different worksheets to different email addresses Spoonerstreet Excel Discussion (Misc queries) 6 October 17th 08 10:39 PM
Macro to send email to multiple addresses Mark M Excel Worksheet Functions 0 March 28th 07 12:12 AM
Can I send a doc to group of email addresses via a macro button? Richard F Excel Discussion (Misc queries) 6 February 5th 07 09:59 AM
Trying to send an email with body text, to a range of cells [email protected] Excel Discussion (Misc queries) 1 November 29th 06 12:28 AM


All times are GMT +1. The time now is 04:54 PM.

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"