Worksheet close event

G

Guest

what is the event that I have to use if I need my macro's to run whenever I
open/close my workbook?

I've used "Auto_Open and Auto_Close". but, problem with this seems to be
that the open macro runs when I open the workbook but, the close macro runs
only when I close all the workbooks (or the Excel application)

how are these handled?
 
G

Guest

I am not sure shy you would be having that problem. Try using the On_Open and
Before_Close events in Thisworkbook (I assume your code is currently in a
standard module).
 
G

Guest

Sorry there is a typo/goof in my post. Here is the full code stub for the
before close

Workbook_BeforeClose(Cancel as Boolean)
 
C

Craig

Private Sub Workbook_Open()

and

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Both in the ThisWorkbook section
 
G

Guest

Baapi,

Your Auto_Open and Auto_Close subs should work if they're located in a
standard module. Note that these are replacements for Workbook_Open and
Workbook_BeforeClose events, of which neither of these events should exist if
using the Auto_ run macros.

HTH
Garry
 

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