PC Review


Reply
Thread Tools Rate Thread

Before Close Event Hide all Worksheets then Close Application

 
 
RyanH
Guest
Posts: n/a
 
      24th Jan 2008
I have a workbook with some sensitive info on certain worksheets. So I
created a BeforeClose_Event that hides all the worksheets when the workbook
is closed. I then created a Login UserForm with usernames and passwords so
when certain users sign in the code will unhide the worksheets that pretain
to that user. The problem is when I click the Red "X" in the top right hand
corner it only hides the worksheets and the workbook remains open, why?

I want all default features of Excel to remain the same, when the Red X is
clicked it gives you the option to save and then the application closes. How
do I do that?

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Windows(ThisWorkbook.Name).Visible = False

End Sub

Private Sub Workbook_Open()

frmLogin.Show

End Sub


Thanks in Advance,
Ryan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application Close Event Robert Schwenn Microsoft Excel Programming 8 25th Mar 2008 01:10 PM
why do all excel worksheets/workbooks close when I close one? =?Utf-8?B?UGVubnk=?= Microsoft Excel Misc 1 29th Nov 2006 03:49 AM
Hide worksheets before close JoeleneW@gmail.com Microsoft Excel New Users 2 26th Apr 2006 07:25 PM
Access 2003 Hide Form to trigger a DB On Close event =?Utf-8?B?UGF0by1jaGFu?= Microsoft Access VBA Modules 2 5th Apr 2006 03:21 PM
Hide() or Close() forms in mdi application? Daniel Billingsley Microsoft Dot NET Framework 2 16th Apr 2004 12:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:58 AM.