View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RigasMinho RigasMinho is offline
external usenet poster
 
Posts: 40
Default Run Macro Before Save

I found this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
End Sub


Where would I put this code? In the general part of the workbook?


Die_Another_Day wrote:
Check out the BeforeSave Event under the "ThisWorkbook" in MicroSoft
Excel Objects in the VBA Editor

Die_Another_Day
RigasMinho wrote:
Is there a way to run a macro each time before you hit the save button.

Meaning if you go to file - save - it runs the macro instead of saving
the file
or if you hit control +s it runs the macro instead of saving the file


Let me know thanks