Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Auto running a macro on closing

Thanks
I was obviously trying to do as Fst1 suggested in the wrong place. Once in
the right area it worked.
--
Jimmy


"Gord Dibben" wrote:

Jimmy

Might be easier to go back to the Excel window and right-click on the Excel Icon
left of "File"

Select "View code"

From left drop-down select "Workbook".

This will appear

Private Sub Workbook_Open()

End Sub

Then from right drop-down select "BeforeClose" and this will appear

Private Sub Workbook_BeforeClose(Cancel As Boolean)

End Sub

Add your macroname like so...............

Private Sub Workbook_BeforeClose(Cancel As Boolean)
macroname
End Sub

Delete the workbook_open and its end sub.


Gord Dibben MS Excel MVP



On Wed, 21 Nov 2007 17:04:45 -0800 (PST), carlo wrote:

Unsure of what you are trying to do. Have tried to follow in vb but am not
able to work out where you are. I am working with excel 97 (possibly a bit of
a dinosaur) but is all I have.
Do I maybe have to start a new vb macro to do this? or can it be done with
the existing macro?
My left drop down only contains (General) and the right has the macro name
and (Declarations)



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
Running a macro from an auto-refresh Chris Youlden Excel Worksheet Functions 2 October 7th 07 04:22 PM
Excel still running in task manager after closing the application Willem Excel Discussion (Misc queries) 0 December 5th 06 01:56 PM
macro closing worksheet Jeff Excel Discussion (Misc queries) 1 July 3rd 06 01:58 PM
Help with auto macro on closing mr_teacher Excel Discussion (Misc queries) 3 May 17th 06 01:07 PM
Auto Save on closing AJM1949 Excel Discussion (Misc queries) 3 September 21st 05 10:03 AM


All times are GMT +1. The time now is 01:03 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"