Hi
I use the code below.
It opens a blank e-mail in Outlook, sets the To and Subject lines and then copies a Named Range on the worksheet and pastes it into the e-mail body.
It then sends the e-mail.
I have 3 computers within my workplace where this code works (all Windows 10 terminals running the same versions of Outlook and Excel).
There is a 4th computer where the code doesn't work. It's exactly the same setup as the other 3.
It does everything apart from paste the range to the e-mail and ends up just sending a completely blank e-mail.
Any ideas what's wrong and why this 1 computer doesn't work?
Are there any other methods? I'm aware of the MailEnvelope option but when I first set out designing this sheet, that method didn't seem to work properly.
Thanks
Liam
I use the code below.
It opens a blank e-mail in Outlook, sets the To and Subject lines and then copies a Named Range on the worksheet and pastes it into the e-mail body.
It then sends the e-mail.
I have 3 computers within my workplace where this code works (all Windows 10 terminals running the same versions of Outlook and Excel).
There is a 4th computer where the code doesn't work. It's exactly the same setup as the other 3.
It does everything apart from paste the range to the e-mail and ends up just sending a completely blank e-mail.
Any ideas what's wrong and why this 1 computer doesn't work?
Are there any other methods? I'm aware of the MailEnvelope option but when I first set out designing this sheet, that method didn't seem to work properly.
Thanks
Liam
Code:
Sub Report_Send()
Response = MsgBox("Is the report ready to send?", vbYesNo, "Send Report")
If Response = vbNo Then Exit Sub
ThisWorkbook.Save
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
Dim OutlookApp, Report_MailObject As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set Report_MailObject = CreateObject("Outlook.Application").CreateItem(olMailItem)
With Report_MailObject
.To = Range("MailingGroup").Value
.Subject = "REPORT | " & UCase(Format(Range("Date").Value, "ddd dd/mm/yyyy")))
End If
.Display
End With
Range("MailRange").Copy
Wait 2
SendKeys "^({v})", True
Wait 2
Report_MailObject.Send
Set Report_MailObject = Nothing
Application.CutCopyMode = False
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.EnableEvents = True
End With
ThisWorkbook.Close True