View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
N1KO N1KO is offline
external usenet poster
 
Posts: 60
Default Closing a workbook

Thanks Otto

"Otto Moehrbach" wrote:

Put these 2 macros in the Workbook module. I assumed that you have a splash
sheet named "Splash". When the file is closed by the user, the first macro
will fire and will make the Splash sheet visible and all the others
VeryHidden. If the file is subsequently opened with macros disabled, all
the user will see is the Splash sheet. If the workbook is opened with
macros enabled, all the sheets will be made visible and the Splash sheet
will be made VeryHidden. HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
Sheets("Splash").Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Splash" Then _
ws.Visible = xlSheetVeryHidden
Next ws
ThisWorkbook.Save
ThisWorkbook.Saved = True
End Sub

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Splash" Then _
ws.Visible = xlSheetVisible
Next ws
Sheets("Splash").Visible = xlSheetVeryHidden
End Sub
"N1KO" wrote in message
...
Basically what happened was, a login box appeared and the "Macro Security"
options didn't appear.

Now the options do (Enable/Disable Macros).

If you disable the macros you can see everything on the sheet, what i need
is for them to see nothing. Could i do something on the close application
macro to maybe hide everything and protect everything and then if they
login
properly and select the enable macro button to show it all again?

Would this be possible?

"Otto Moehrbach" wrote:

Basically, you can setup a macro that runs whenever the file is closed.
That macro would set your data to a condition that would render the
workbook
useless. Then you would have another macro that fires whenever the
workbook
is opened. That macro would reset your data to what you want. HTH Otto
"N1KO" wrote in message
...
Hi,

I need (if possible) for a workbook to close if the "Disable Macro"
button
is clicked when the workbook first opens.

Is this possible?

Thanks in advance

NIKO