Long time to OPEN, CLOSE, and SAVE an Excel file

rhkan

New Member
Joined
May 19, 2003
Messages
5
I have an Excel workbook with about 60 Worksheets, many formulas, and
some macros/VB code. It has grown to about 50 MB. Despite the size,
this file could be opened/closed/saved in less than 2 minutes.

However, once I added PROTECTION to the workbooks and each of the
sheets, the workbook took over 10 minutes to open/close/save!!

To try to solve this, I added the following VB code below to unprotect
the entire workbook and its 60 sheets JUST BEFORE CLOSING the file.
And then I added code to protect the workbook whenever the FILE is
OPENED. This did not improve the process.

Any suggestions? Please help...


*************************************************************
CODE
*************************************************************

Public Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Unprotect ("richard")
Sheet1.Unprotect ("richard")
'the previous line is repeated for all 60 sheets
End Sub
----------------------------------------------------------------------------

Public Sub Workbook_Open()
ThisWorkbook.Protect ("richard")
Sheet1.Protect ("richard")
'the previous line is repeated for all 60 sheets
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
have you turned off screen updating and switched calculation to manual?

eg

Private Sub Workbook_Open()

Dim ws as Worksheet

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

For Each ws in ActiveWorkbook.Worksheets
ws.Unprotect Password:="password"
Next ws

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub

and obviously same code for close with ws.protect replacing unprotect.
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,336
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top