Thread: Sending mail
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tomas Stroem Tomas Stroem is offline
external usenet poster
 
Posts: 26
Default Sending mail

Will change this to make it exactly as I want to have it run.

Again Many Thanks
--
Tomas S


"Joshua Fandango" wrote:

Just noticed... in the With OutMail change ".display" to ".send" to
have it actually send

Ooops! :)

On 10 Dec, 12:16, Tomas Stroem
wrote:
Joshua,

This works great for me to, Many thanks !!
--
Tomas S



"Joshua Fandango" wrote:
Hi Tomas,


The following works great for me.
Have it in a standard module & call it from the Before Save event.


Sub Email_This_Wbk()
Dim OutApp As Object
Dim OutMail As Object


Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)


On Error Resume Next
With OutMail
.To = "
.CC = "
.BCC = "
.Subject = "This week's reports"
.Body = "What ever you want"
.Attachments.Add ActiveWorkbook.FullName
.display
End With
On Error GoTo 0


Set OutMail = Nothing
Set OutApp = Nothing
End Sub
----------------------------------------------------------------


HtH,
JF


On 10 Dec, 07:26, Tomas Stroem
wrote:
I want to send a file to multiple persons by using a macro that runs each
time the file is saved. It works perfectly well with one person, but not when
I try to add more names. What is the correct syntax to do this? Code added
below


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.SendMail ,
", Subject:="Filename"


End Sub


--
Tomas S- Hide quoted text -


- Show quoted text -