Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Before Close Event Hide all Worksheets then Close Application

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
captcure close application event suru Excel Worksheet Functions 2 June 17th 09 07:10 AM
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
Hide worksheets before close [email protected] New Users to Excel 2 April 26th 06 07:25 PM
difference application.quit & application.close Pierre via OfficeKB.com[_2_] Excel Programming 4 November 8th 05 07:55 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM


All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"