Prevent opening the workbook on condition

sofas

Well-known Member
Joined
Sep 11, 2022
Messages
559
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Hello. I have a login screen for an Excel file. The username is in Combobox 10 and the password is in Textbox 10. I want a way. When I enter the password incorrectly 2 times, the file is locked for 30 minutes and cannot be opened until after that time. Even if anyone tries to open it, it is locked automatically.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You could record the user name failure times in a specific area of a sheet and upon opening the workbook, confirm that time is more than 30 minutes in the past...HOWEVER...in order for that to work, the user would need to "enable content" when they open the workbook to allow the code to run. If they don't allow it, they'll still be able to open the workbook.

1724681947346.png
 
Upvote 0
You could record the user name failure times in a specific area of a sheet and upon opening the workbook, confirm that time is more than 30 minutes in the past...HOWEVER...in order for that to work, the user would need to "enable content" when they open the workbook to allow the code to run. If they don't allow it, they'll still be able to open the workbook.

View attachment 115964
I use the feature to hide the workbook and show the user form in Private Sub Workbook_Open() as I think that when the password is entered incorrectly, the macro will already be activated on my end.
 
Upvote 0

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

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