auto close

imranrashid

New Member
Joined
Mar 26, 2002
Messages
3
Today is 28.MAR.2002
A1 is 27.mar.2002

if file is open today it should not work in anyway but just close.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Double click on thisworkbook object in VBA project and open the code. Then find the Sub Workbook_Open and use the code below..
'Assume you dont want to show sheet1
Private Sub Workbook_Open()
If Sheet1.Cells(1, 1) < Now() Then
Close False
Else
'This part avoid using sheet1 if user opens the workbook by clicking Disable Macros. So you need to set Sheet1.Visible property in Propertie window to 2 (xlSheetVeryHidden)
Sheet1.Visible = xlSheetVisible
End If
End Sub

'To make sheet1 xlVeryHidden before closing workbook (after making some changes etc)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheet1.Visible = xlSheetVeryHidden
End Sub

Or some other ways like protecting and unprotecting sheets in code with this way.

regards
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,238
Members
448,555
Latest member
RobertJones1986

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