I have the folowing code below and have to select "allow" before sending the emails.
The code allows me to email each of the sheets to a recvipient address in cell A1 on each of the sheets
I would like to be able to view the emails be clicking send on Outlook
It would be appreciated if someone could please assist me in amending the code
The code allows me to email each of the sheets to a recvipient address in cell A1 on each of the sheets
I would like to be able to view the emails be clicking send on Outlook
It would be appreciated if someone could please assist me in amending the code
Code:
Sub mailWorksheets()
Application.ScreenUpdating = False 'freeze display for speedup
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each w In ThisWorkbook.Worksheets 'loop through all sheets
If w.[a1].Value Like "*@*" Then 'check for email address in cell [A1]
w.Copy 'copy worksheet to new workbook
ActiveWorkbook.SaveAs "Sheet " & w.Name & " of " & ThisWorkbook.Name & ".xls"
zSendTo = ActiveSheet.[a1].Value 'email recipient
zSubject = "Sales Comm File" '<-edit subject line here as required
ActiveWorkbook.SendMail zSendTo, zSubject 'send email to recipient
ActiveWorkbook.ChangeFileAccess xlReadOnly 'change workbook to read-only for deletion
Kill ActiveWorkbook.FullName 'delete saved copy of temporary workbook
ActiveWorkbook.Close False 'close temporary workwook
End If 'end of test for email address in cell [A1]
Next w 'process next worksheet
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Application.ScreenUpdating = True 'refresh display
End Sub