Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Worksheet close event

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?
--
Baapi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Worksheet close event

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).
--
HTH...

Jim Thomlinson


"Baapi" wrote:

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?
--
Baapi

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Worksheet close event

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

Workbook_BeforeClose(Cancel as Boolean)

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

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).
--
HTH...

Jim Thomlinson


"Baapi" wrote:

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?
--
Baapi

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Worksheet close event

Private Sub Workbook_Open()

and

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Both in the ThisWorkbook section

  #5   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Worksheet close event

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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does userform close after programming worksheet event with CreateEventProc or AddFromString tr00per Excel Programming 3 February 4th 06 10:09 PM
Worksheet close event++? has ex Excel Programming 1 April 13th 05 12:05 AM
Worksheet close event? has ex Excel Programming 4 April 12th 05 11:43 PM
Event Procedures: Event on Worksheet to fire Event on another Worksheet Kathryn Excel Programming 2 April 7th 04 07:35 PM


All times are GMT +1. The time now is 06:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"