LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Before Close workbook?

I have protected sheet and workbook with password.
I have this code and is working ok. Does anyone have some suggestions to
this code, as I am beginner?

Private Sub Workbook_BeforeClose(cancel As Boolean)
Dim L As Long
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect (5)
Me.Worksheets(1).Visible = True
For L = 2 To Me.Worksheets.Count
Me.Worksheets(L).Visible = xlVeryHidden
Next

ActiveWorkbook.Protect Password:="5", Structu=True, Windows:=False
ActiveWorkbook.Save
End Sub

similar is for Open


 
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
close only one workbook bobsmom70601 New Users to Excel 1 March 8th 05 09:43 PM
to close a workbook via VBA J_J[_2_] Excel Programming 3 February 20th 05 01:11 PM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM
Close a workbook Mike G. Excel Programming 1 June 1st 04 06:50 PM
How can I close a workbook using VBA? Trevor[_4_] Excel Programming 2 March 2nd 04 01:12 AM


All times are GMT +1. The time now is 04:10 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"