Script to send excel sheet at close of excel

Closed
gregoryps Posts 8 Registration date Tuesday June 8, 2010 Status Member Last seen June 11, 2010 - Jun 9, 2010 at 11:10 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 9, 2010 at 12:36 PM
Hello,

Is there a way to write a script to copy a sheet and email it when someone closed excel? I am trying to get a sheet called "Daily Closures" to email when they close excel.

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 9, 2010 at 11:37 AM
Define you email routine under "ThisWorkbook"

This is the routine that you need to target for emailing

Private Sub Workbook_BeforeClose(Cancel As Boolean)

End Sub
0
gregoryps Posts 8 Registration date Tuesday June 8, 2010 Status Member Last seen June 11, 2010
Jun 9, 2010 at 11:55 AM
Thank you. I have written a script to email data from a sheet, but not an entire sheet as a excel file. I will try to write the script.
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 9, 2010 at 12:36 PM
Perhaps most easy way might be if you export that sheet as a new workbook and then use send book via email

Here is a good example

https://www.ozgrid.com/VBA/send-email.htm
0