Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I found the following code on a website recommened by this newsgroup. Can
any one tell me what I need to add/delete or change to create an input box for the user to type what should go in the body of the email. Other than that this works GREAT! Sub Outlook_Mail_Every_Worksheet() Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Dim strdate As String Dim wb As Workbook Dim ws As Worksheet Application.ScreenUpdating = False Set OutApp = CreateObject("Outlook.Application") For Each ws In ThisWorkbook.Worksheets If ws.Range("a1").Value Like "?*@?*.?*" Then strdate = Format(Now, "dd-mm-yy h-mm-ss") ws.Copy Set wb = ActiveWorkbook With wb .SaveAs "Sheet " & ws.Name & " of " _ & ThisWorkbook.Name & " " & strdate & ".xls" Set OutMail = OutApp.CreateItem(olMailItem) With OutMail .To = ws.Range("a1").Value .CC = "" .BCC = "" .Subject = "This is the Subject line" .Body = "Hi" & vbNewLine & vbNewLine & _ "This is line 1" & vbNewLine & _ "This is line 2" & vbNewLine & _ "This is line 3" & vbNewLine & _ "This is line 4" .Attachments.Add wb.FullName .Send End With .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Set OutMail = Nothing End If Next ws Set OutApp = Nothing Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hyperlink in body of VBA email | Excel Discussion (Misc queries) | |||
message in the body of the email | Excel Worksheet Functions | |||
Outlook email url in body | Excel Programming | |||
body of email disappears when I send an email from Excel | Excel Discussion (Misc queries) | |||
Excel within the body of an email | Excel Programming |