View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Michael Michael is offline
external usenet poster
 
Posts: 791
Default Running a Script upon Saving a File

Got it! Thanks guys!

"mark" wrote:

Let say I make a change to the data contained in the worksheets and then
save the file. He would like a script to be run that would ask for a name and
store that information along with the date stored in the worksheet that was
changed.



It sounds like you want to use the workbook's BeforeSave Event :

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

'code here

End Sub

In the VBA Editor window, use View-Project Explorer, then select
ThisWorkbook , use the left dropbox at the top to select Workbook, and then
the right drop box to select BeforeSave