Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Create email from cells in Excel?

I have several Worksheets that I want to create emails from.

I want to populate the To: Subject: and body from cells in the spreadsheet.

Whats the best way to do this?

Thank you,
Scott<-

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Create email from cells in Excel?

Hi Scott,

Ron de Bruin has an extensive set of exanple
procedures for sending emails at:

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

See for example:

Sub Mail_Sheets_Array()
http://www.rondebruin.nl/mail/folder2/mail3.htm

You could easily replace the hardcoded values for To,
Body, Subject etc with cell referencea or an array of
values


---
Regards,
Norman


"Scott Townsend" wrote in message
...
I have several Worksheets that I want to create emails from.

I want to populate the To: Subject: and body from cells in the
spreadsheet.

Whats the best way to do this?

Thank you,
Scott<-



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Create email from cells in Excel?

Scott,

A simple method is as follows:


Sub SendMySheet()
Dim Recip As String
Dim Subj As String
'''''''''''''''''''''''''''''''''''''''''''''''''' '
' Get recipient out of MySheet!A1
' Get subject out of MySheet!A2
'''''''''''''''''''''''''''''''''''''''''''''''''' '
Recip = ThisWorkbook.Worksheets("MySheet").Range("A1").Tex t
Subj = ThisWorkbook.Worksheets("MySheet").Range("A2").Tex t
'''''''''''''''''''''''''''''''''''''''''''''''''' '
' The following will create a new workbook
' containing only a copy of MySheet. That newly
' created workbook will become the ActiveWorkbook.
'''''''''''''''''''''''''''''''''''''''''''''''''' '
ThisWorkbook.Worksheets("MySheet").Copy
'''''''''''''''''''''''''''''''''''''''''''''''''' '
' ActiveWorkbook is now the newly created workbook.
'''''''''''''''''''''''''''''''''''''''''''''''''' '
ActiveWorkbook.SendMail Recipients:=Recip, Subject:=Subj
ActiveWorkbook.Close savechanges:=False
End Sub

Ron de Bruin is the guru of all things email in Excel. See his site at
http://www.rondebruin.nl/ for much more details and other ways to go about
mailing workbooks.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)

"Scott Townsend" wrote in message
...
I have several Worksheets that I want to create emails from.

I want to populate the To: Subject: and body from cells in the
spreadsheet.

Whats the best way to do this?

Thank you,
Scott<-



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Create email from cells in Excel?

Thanks!
I ended up with the Following:

Sub SendEmail_Click()
' Working in Office 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim Ash As Worksheet

Set Ash = ActiveSheet
On Error GoTo cleanup
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon

With Application
.EnableEvents = False
.ScreenUpdating = False
End With


Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = Ash.Range("A2").Value
.Subject = Ash.Range("A40").Value
.Body = Ash.Range("A43").Value & vbNewLine & _
Ash.Range("A44").Value & vbNewLine & _
Ash.Range("A45").Value & vbNewLine & _
Ash.Range("A46").Value & vbNewLine & _
Ash.Range("A47").Value & vbNewLine & _
Ash.Range("A48").Value & vbNewLine & _
Ash.Range("A49").Value & vbNewLine & _
Ash.Range("A50").Value & vbNewLine & _
Ash.Range("A51").Value & vbNewLine & _
Ash.Range("A52").Value & vbNewLine & _
Ash.Range("A53").Value & vbNewLine & _
Ash.Range("A54").Value & vbNewLine


.Display
'.Send 'Or use Display
End With
On Error GoTo 0

Set OutMail = Nothing
Ash.AutoFilterMode = False

cleanup:
Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With

End Sub

"Norman Jones" wrote in message
...
Hi Scott,

Ron de Bruin has an extensive set of exanple
procedures for sending emails at:

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

See for example:

Sub Mail_Sheets_Array()
http://www.rondebruin.nl/mail/folder2/mail3.htm

You could easily replace the hardcoded values for To,
Body, Subject etc with cell referencea or an array of
values


---
Regards,
Norman


"Scott Townsend" wrote in message
...
I have several Worksheets that I want to create emails from.

I want to populate the To: Subject: and body from cells in the
spreadsheet.

Whats the best way to do this?

Thank you,
Scott<-




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
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
how do I create email list from individual emails in Excel cells? Matt W Excel Discussion (Misc queries) 2 January 26th 08 08:53 AM
How do I create an email macro to auto fill the email? Justin[_4_] Excel Discussion (Misc queries) 0 November 14th 07 10:49 PM
Create Outlook email from Excel DoooWhat Excel Discussion (Misc queries) 1 April 9th 07 07:20 PM
Range of Cells to create body of email Hahndo Excel Worksheet Functions 1 September 26th 05 07:00 PM


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