Marco Run on File Close

G

Grant

I have a macro that I want to run when/before the file closes.
I tried to call the procedure using the following code, but the procedure
did not run.

Private Sub Workbook_BeforeClose()
Call Clear_Details
End Sub


Any help?

Thanks
 
R

Ron de Bruin

Hi Grant

Where have you copy/paste this event ?

It must be in the Thisworkbook module
 
J

Jon

Did you get an error message, or did Clear_Details simply
fail to run?

The location of the code for Clear_Details could cause
this problem. If the code is in a module and the sub is
delcared Private, you won't be able to run it from the
workbook_beforeclose event. Try making it public, or
moving the code to the general declarations section of
the workbook.

-Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top