View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Jackson Jim Jackson is offline
external usenet poster
 
Posts: 324
Default Unhiding worksheets if Close is Canceled

If msgbox("Your Message", vbOK,Cancel) = vbCancel then
'Return sheet hiding etc. to desired state.
End if
--
Best wishes,

Jim


"JustBreathe" wrote:

I've put in the coding that has been suggested to others as the work-around
for not being able to enable macros with a macro.

It hides all the worksheets (except for 'Sheet1' which contains the message
to that the workbook need to be opened with macros enabled ) before closing.
When the workbook is opened with macos enabled, code will unhide those hidden
sheets and hid 'Sheet1'.

This works, except that I have realized that if 'Cancel' is selected when
closing, it leaves the 'Sheet1' reminder sheet visible and the working tabs
hidden. Is there a way to code the beforeclose section so that the worksheet
will revert back to 'sheet1 hidden' and all other sheets visible in the event
the user decides not to close but to continue working in the file?

TIA
Tanya (self-teach VBA as i go)