Emailing using VBA

S

steve

XL 97

Below is a copy of code that I am using to email some
worksheets (many worksheets) in a workbook to different
individuals (many individuals) I need to be able to add
text msgs in the body

Sub Mail_every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim wb1 As Workbook
Dim strdate As String
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
For Each sh In wb1.Worksheets
If sh.Range("a1").Value Like "*@*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " & _
wb1.Name & " " & strdate & ".xls"
.SendMail "(e-mail address removed)", _
"I have emailed using VB now"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub


This line Below will pause the send mail and let me type
the msg in the body, but then I have to select/type all
the email address individually (that will take forever
cause of the number of names).

..SendMail "", "This is the Subject line"


I'm using a form letter for the body. Is their some way
to enter text into the body with vba with out having to
use the sendkey command?


Code form:
http://www.rondebruin.nl/sendmail.htm#sheets
 
R

Ron de Bruin

With SendMail you can't Steve

Tell me your mail program and operating system then
I can help you maybe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top