I have a macro to email and attach a workbook
I need the workbook to select sheet "Pivot" before attaching the workbook so that when the attached workbook is opened , it opens on sheet "pivot"
Sub Email_Report()
Sheets("Pivot").Select
ThisWorkbook.Activate 'start in THIS workbook
ztext = [bodytext] 'read in text from named cell
Zsubject = [subjectText]
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Sheets("Email").Range("t1:T1").Value
.CC = Join(Application.Transpose(Sheets("email").Range("T2:T5").Value), ";")
.BCC = ""
.Subject = Zsubject
.Body = ztext
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
ActiveWorkbook.Save
End Sub
Bookmarks