View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Run Macro on close

hi,
Open the vb editor. Alt+F11
in the project window (left), expand your project (file name).
Double click ThisWorkbook
in the object box (top middle) cick the down arrow then click workbook.
default is workbook_open(). ignore for now.
in the procedure box (right of object box) scroll to and select Beforeclose.
you wil get this below. you can delete the default WorkbookOpen.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

End Sub

Put your code between Private sub and end sub.
close the vb editor and save file

Regards
FSt1


"Donnie" wrote:

Where do I find the close event?
I'm not sure where to find the VBA, only the Macros.
Thanks anyway

"FSt1" wrote:

hi,
put your code in the before close event of the workbook.
no special coding needed.

Regards
FSt1

"Donnie" wrote:

How do I phrase the VBA to run a macro on closing the spreadsheet?

Any ideas?

Thanks
Donnie