I have macro to email several sheets, but do not want to attach those sheets where A2 is blank
It would be appreciated if someone could amend my code
It would be appreciated if someone could amend my code
Code:
|
With ActiveWorkbook |
'.Windows(1).Visible = False |
Application.DisplayAlerts = False |
.SaveAs Environ("TMP") & "\" & ThisWorkbook.Sheets("sales1").Name & ".xlsx" |
Application.DisplayAlerts = True |
.Close (True) |
End With |
With CreateObject("Outlook.Application").CreateItem(0) |
.To = Join(Application.Transpose(Sheets("Email sales").Range("AA1:AA3").Value), ";") |
.Subject = Zsubject |
.Body = Ztext |
.Attachments.Add Environ("TMP") & "\" & ThisWorkbook.Sheets("sales1").Name & ".xlsx" |
.Display |
'.send |
End With |
End Sub |