Hi ,
I mail my worksheets with a push of a button , but I have one question :
I would like to get a warning ( msgbox) when there is no emailadres present in cell H16 !
Who can help me ?
Thanks in advance !
Ed
EDIT: Added Code tags - Moderator
I mail my worksheets with a push of a button , but I have one question :
I would like to get a warning ( msgbox) when there is no emailadres present in cell H16 !
Who can help me ?
Thanks in advance !
Ed
Code:
Dim strDate As String
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
'Mail worksheet TO emailadres in cell h16
If sh.Range("H16").Value Like "*@*" Then
sh.Copy
strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
'Name worksheet
ActiveWorkbook.SaveAs " " & ThisWorkbook.Name _
& " " & strDate & ".xls"
ActiveWorkbook.SendMail ActiveSheet.Range("H16").Value, _
"test test "
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End If
Next sh
Application.ScreenUpdating = True
End Sub
EDIT: Added Code tags - Moderator