Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macros on workbook close and save

I wish to force the users to use a macro and so I have adopted the suggestion
I found here for using a message sheet warning the user to activate the
macro, and a startup macro that hides the warning message and unhides all the
other sheets.

In order to give the user the option of leaving without saving, I have tried
to install a macro that restores shows the warning sheet hides the others (as
I want it to be saved for the next open) and returns the user to where they
were in the workbook.
(this I found in this community - thanks).

I use a BeforeSave that does the hiding and unhiding, and then an Activate
in the warning worksheet, which calls a sub that returns the user to where
they were.

My problem is that if the user tries to close the workbook and opts to save
their changes, then the warning sheet appears, the workbook saves, and
closes, But then the activate / deactivate macros warning appears, and upon
clicking activate, the workbook re-opens ready for use.

Sorry, not that easy to explain.
Has anyone any ideas how I can get around this?

Adrian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macros on workbook close and save

Without the code, it is difficult to be sure, but I think I see what you
mean.

I would change things to this logical order in Beforeesave event

- disable events - Application.EnableEvents = False
- hide and unhide as required (no event will fire)
- run the macro to return the user directly (not from activate event)
- ask if they want to save, if not set Cancel to True
- enable events

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ade P" wrote in message
...
I wish to force the users to use a macro and so I have adopted the

suggestion
I found here for using a message sheet warning the user to activate the
macro, and a startup macro that hides the warning message and unhides all

the
other sheets.

In order to give the user the option of leaving without saving, I have

tried
to install a macro that restores shows the warning sheet hides the others

(as
I want it to be saved for the next open) and returns the user to where

they
were in the workbook.
(this I found in this community - thanks).

I use a BeforeSave that does the hiding and unhiding, and then an Activate
in the warning worksheet, which calls a sub that returns the user to where
they were.

My problem is that if the user tries to close the workbook and opts to

save
their changes, then the warning sheet appears, the workbook saves, and
closes, But then the activate / deactivate macros warning appears, and

upon
clicking activate, the workbook re-opens ready for use.

Sorry, not that easy to explain.
Has anyone any ideas how I can get around this?

Adrian



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
close workbook without saving or promt to save ATVNSHANE Excel Discussion (Misc queries) 3 February 4th 10 03:57 PM
Option in Excel to save a close a workbook inactive for 5 minutes Patricia Peterson Excel Discussion (Misc queries) 4 January 5th 06 05:00 PM
Excel 2002 Automate shared workbook at close to save changes to new document tmerrifield Excel Programming 0 October 27th 04 03:45 PM
Close a workbook without saving macros Papa Jonah Excel Programming 12 October 27th 04 12:43 AM
Close Workbook without displaying message to Save Vinay[_2_] Excel Programming 2 June 10th 04 05:05 PM


All times are GMT +1. The time now is 04:09 PM.

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

About Us

"It's about Microsoft Excel"