Asked by Pitfour
at 2024-07-16 16:10:23
Point:500 Replies:3 POST_ID:828994USER_ID:11894
Topic:
Microsoft Applications;;
This code works fine in Excel 2003 :
Sub Send_Email_Current_Workbook()
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 = "xxx.xxx@xxx.xxx.uk"
.CC = ""
.BCC = ""
.Subject = "XXX Update"
.Body = "See attached"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
but this attaches the whole workbook. I really need to attach the relevant daily sheet. As it stands, the macro button is only on one master worksheet.
Sub Send_Email_Current_Workbook()
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 = "xxx.xxx@xxx.xxx.uk"
.CC = ""
.BCC = ""
.Subject = "XXX Update"
.Body = "See attached"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
but this attaches the whole workbook. I really need to attach the relevant daily sheet. As it stands, the macro button is only on one master worksheet.