View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default HELP!!!! Calling a sub from Workbook_BeforeSave

Assuming the module is in the spreadsheet and not in an addin or some other
spreadsheet then... (I am assuming that your procedure does a save and that
you do not need to worry about Save vs SaveAs)

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
on error goto ErrorHandler

Cancel = True 'Assuming you want to cancel the save done by the user
Application.enableevents = false 'Assuming your called procedure does a save
Call SLOCSave.SSave

ErrorHandler:
application.enableevents = true
End Sub
--
HTH...

Jim Thomlinson


"RocketMan" wrote:

I have a sub called SSave in a module called SLOCSave which I would
like to call in private sub Workbook_BeforeSave but I can't figure out
how.

HELP

John