Issue on Close Q
Thanks Guys, Fixed
Dave Peterson wrote:
And since one sheet must be visible, you might as make sure it's Splash:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet 'not worksheets
me.worksheets("splash").visible = xlsheetvisible
For Each ws In me.Worksheets
If lcase(ws.Name) = lcase("Splash") Then
'do nothing, already taken care of
Else
ws.Visible = xlVeryHidden
End If
Next ws
End Sub
Remember that the workbook still has to be saved for this to work
effectively--if the user closes without saving, all your work is to naught.
Sean wrote:
I have the following code that, on close, it hides all the Sheets
except Splash. Problem is I'm getting a debug on -
ws.Visible = xlVeryHidden
It says - Unable to set the visible property of the worksheet class
I've all sheets protected and running 2003
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sh As Worksheet
For Each ws In Worksheets
If ws.Name = "Splash" Then
ws.Visible = True
Else
ws.Visible = xlVeryHidden
End If
Next
End Sub
--
Dave Peterson
|