Script to send excel sheet at close of excel [Closed]

Report
Posts
8
Registration date
Tuesday June 8, 2010
Status
Member
Last seen
June 11, 2010
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
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 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
761
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
Posts
8
Registration date
Tuesday June 8, 2010
Status
Member
Last seen
June 11, 2010

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.
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
761
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

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!