I am trying to have the VBA code in the Filter sheet email (but actually just save the email to the drafts folder so I can send later)
It semi works but seems to overwright the previous one I sent (I send about 6 with different data to different email addresses)
Ideally id like the option to ”send now” or “save to drafts”
If you can have a look at it id appreciate it
Private Sub Send_MailEnvelope_Click()
'Working in Excel 2002-201
Dim AWorksheet As Worksheet
Dim Sendrng As Range
Dim rng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Fill in the Worksheet/range you want to mail
'Note: if you use one cell it will send the whole worksheet
Set Sendrng = Worksheets("Filter").Range("A9")
'Remember the activesheet
Set AWorksheet = ActiveSheet
With Sendrng
' Select the worksheet with the range you want to send
.Parent.Select
'Remember the ActiveCell on that worksheet
Set rng = ActiveCell
'Select the range you want to mail
Dim sht As Worksheet
Dim StartCell As Range
Set sht = Worksheets("Filter")
Set StartCell = Range("A9")
'Select Range
StartCell.CurrentRegion.Select
' Create the mail and send it
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
' Set the optional introduction field thats adds
' some header text to the email body.
.Introduction = ThisWorkbook.Sheets("Filter").Range("D1").Value
With .Item
.To = ThisWorkbook.Sheets("Filter").Range("A1").Value
.CC = ""
.BCC = ""
.Subject = "My Jobs in Tomorrow's Diary"
.Save
'.Close 'olPromtForSave
End With
End With
'select the original ActiveCell
rng.Select
End With
'Activate the sheet that was active before you run the macro
AWorksheet.Select
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub
Bookmarks