N
Nigel
I am using the following VBA code in Excel to send
attached workbooks via email. It works great but I need to
modify this somehow.
1. Currently when this is run the FROM name is the person
of the logged in user on the current PC, how can I change
this in the programme - Really want it to be something
like "ARTS - Automated Mail"
2. A copy of this email (and attachment) is stored in the
senders sent items folder, is there a way to suppress this?
Current code follows
Sub MailWorkbook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "Test Email"
.Body = vbCrLf & vbCrLf & vbCrLf & _
"This is an automated email from the ARTS - Audit
Customer Data programme " & _
"to advise that the summary report has been
created and is attached to this email. "
Attachments.Add vPathOut & vOutBook, olByValue, 1,
Sheets("Data").Range("A2").Value
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
attached workbooks via email. It works great but I need to
modify this somehow.
1. Currently when this is run the FROM name is the person
of the logged in user on the current PC, how can I change
this in the programme - Really want it to be something
like "ARTS - Automated Mail"
2. A copy of this email (and attachment) is stored in the
senders sent items folder, is there a way to suppress this?
Current code follows
Sub MailWorkbook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "Test Email"
.Body = vbCrLf & vbCrLf & vbCrLf & _
"This is an automated email from the ARTS - Audit
Customer Data programme " & _
"to advise that the summary report has been
created and is attached to this email. "
Attachments.Add vPathOut & vOutBook, olByValue, 1,
Sheets("Data").Range("A2").Value
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub