I have VBA Code to create an email in outlook and attach the sheet called "Movement." The file to be attached to be named Group Movement.XLS and to be valued i.e.. no formulas to be shown on the attached sheet. I have VBA code below which I need amended to comply with my request
Your assistance is most appreciated
Your assistance is most appreciated
Code:
Sub Email_Movement()
ThisWorkbook.Activate 'start in THIS workbook
ztext = [bodytext] 'read in text from named cell
Zsubject = [subjectText]
Dim OutApp As Object
Dim OutMail As Object
Dim File As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
File = ThisWorkbook.Path & "\" & ThisWorkbook.Name ' use the current workbook
With OutMail
.To = Join(Application.Transpose(Sheets("Email").Range("AA1:AA3").Value), ";")
.CC = Join(Application.Transpose(Range("AB1:AB7").Value), ";")
.BCC = ""
.Subject = Zsubject
.Body = ztext
'Attach the sheet "Movement"
Sheets("Movement").Copy
.Attachments.Add File:=ActiveWorkbook.FullName, _
Type:=olByValue, _
Name:="Movement.xlsm"
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub