On close and before save events.

  • Thread starter Thread starter Austin
  • Start date Start date
A

Austin

Hello

I have a workbook, when the user exits the workbook I want
it to hide (using veryhidden) all the worksheets.
When a new user opens the workbook I want to make them
select enable macros or nothing but a blank worksheet will
show.

This all I can do. The problem I face is if I add the hide
worksheets code to the before close event. If a user saves
and then tries to close the book the macro runs and then
excel asks the usual, changes have been made do u want to
save. And so the user has to save again. If I attach the
code to before save, the user may not want to close the
workbook so I don't want the macro to run.

Is there a way around this?

Austin
 
In the beforeclose event, turn off events, hide the sheets, save the
workbook, Turn events back on, continue closing. I haven't tested it
recently, but I expect that you shouldn't get prompted since you just saved
the workbook (which you need to do anyway if you want the sheets to be
hidden).
 

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

Back
Top