#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Email with excel

Here is the code that i have so far. The range A1:A2 is where emails
are stored. The range will become larger when this works correctly.
I am trying to email multiple recipients based on information that I
have in cells on a worksheet. Any guidance woudl be greatly
appreciated.

Sub SendActiveWorkbook()
Dim eMail As String
eMail = ConcRange(Range("A1:A2"), "; ", False, False)
ActiveWorkbook.SendMail _
Recipients:=eMail, _
Subject:="Try Me " & Format(Date, "dd/mmm/yy")
End Sub


Here is the code for the ConcRange function.

Function ConcRange(Substrings As Range, Optional Delim As String =
";", _
Optional AsDisplayed As Boolean = False, Optional SkipBlanks As
Boolean = False)
Dim CLL As Range
For Each CLL In Substrings.Cells
If Not (SkipBlanks And Trim(CLL) = "") Then
ConcRange = ConcRange & Delim & IIf(AsDisplayed,
Trim(CLL.Text), _
Trim(CLL.Value))
End If
Next CLL
ConcRange = Mid$(ConcRange, Len(Delim) + 1)
End Function

Thank You,
Jay
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Email with excel

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

For example

Dim MyArr As Variant
MyArr = Sheets("mysheet").Range("C1:C10")
..SendMail MyArr, "This is the Subject line"




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"jlclyde" wrote in message ...
Here is the code that i have so far. The range A1:A2 is where emails
are stored. The range will become larger when this works correctly.
I am trying to email multiple recipients based on information that I
have in cells on a worksheet. Any guidance woudl be greatly
appreciated.

Sub SendActiveWorkbook()
Dim eMail As String
eMail = ConcRange(Range("A1:A2"), "; ", False, False)
ActiveWorkbook.SendMail _
Recipients:=eMail, _
Subject:="Try Me " & Format(Date, "dd/mmm/yy")
End Sub


Here is the code for the ConcRange function.

Function ConcRange(Substrings As Range, Optional Delim As String =
";", _
Optional AsDisplayed As Boolean = False, Optional SkipBlanks As
Boolean = False)
Dim CLL As Range
For Each CLL In Substrings.Cells
If Not (SkipBlanks And Trim(CLL) = "") Then
ConcRange = ConcRange & Delim & IIf(AsDisplayed,
Trim(CLL.Text), _
Trim(CLL.Value))
End If
Next CLL
ConcRange = Mid$(ConcRange, Len(Delim) + 1)
End Function

Thank You,
Jay

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
Email addresses in Excel need to format for mass email Boomer Excel Worksheet Functions 1 June 9th 06 02:46 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 07:07 PM
Email editor closes when forwarding Excel-embedded email Bambina Setting up and Configuration of Excel 0 March 16th 06 11:45 PM
working on excel document in email saved changes in email not in . butter Excel Discussion (Misc queries) 2 February 20th 06 10:25 AM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 11:55 PM


All times are GMT +1. The time now is 05:07 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"