Workbook open with a password (Userform), something like the Windows entrance

Nikko

Board Regular
Joined
Nov 26, 2018
Messages
73
Hello people need your help for a “moment“ :).

After a long search back and forth on the Internet, I dared to write about my problem here in the forum.
In advance I am not a big light in VBA, rather one who would like to do everything in Excel, but who has to learn this first.
So I’m hopelessly in a dead end ?.

Need the following help:
I want the workbook to just open with a password. With User form before the workbook opens.
At the same time he should be able to change the password there (if he knows the old one).
In the end, if he forgot it, he should be able to send an email asking what he could do.
Basically something like it is in the Windows entrance.

If someone can give me an approach, would be helped a lot.
I searched everywhere on the internet as far as possible, the best ideas were here in the forum, but here too nothing in this direction was to be found (as far as I may have searched correctly).

Any help is welcome.

Thx in Advance,

Nikko
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
This is a quick one that I have built for you. It is only a guide and you can use it to guide you in the right direction.

Download from here Link for download

There are 3 Sheet, Sheet2 is hidden and will need a Password to be unhidden.

Sheet1 is a cover and Blank, workbook will always open on sheet1

Sheet 2 is hidden and this will need a Password to unhide, this is where your data will go. It will re-hide when workbook is closed
1589119753123.png


Sheet3 Records the attempts users made to login Sheet is PASSWORD PROTECTED cell are locked = Password123, if you change THIS password you will need to do it throughout the whole code, as it is in several places.
1589119671925.png


There are 2 userforms.

Form1 is the login form, input Name and Password. Password is case Sensitive, I think.
1589119579473.png

Login, Name is only for your record, Password is my name Sharid. This is in Column "O" Sheet3 and is Hidden

Reset, Use same form, Password is UnLockMe It may be case sensitive I can't remember. Now Click the reset Button. and column "O" will unhide. Type in new password in Cell "O2"

Before...............................................After
1589120072536.png
1589120183424.png


Only Column "O" cells are unlocked all others are locked. YOU CAN NOW CHANGE THE PASSWORD.

If you want to change the reset password from UnLockMe to some thing else then you have to show column P as it too is hidden in sheet3
1589120524554.png

Click on Unlock Sheet column "P" click on the text in BLUE
1589120674268.png


Type Sheet Password = Password123
1589120777577.png


If you forget to hide the columns, that does not matter as the code will do it for you when it closes the workbook.

To change the sheet Password which is Password123 you will need to do this throughout the code as it is in several places.

Hope this helps and guides, as I have only built this as a guide for you. Sorry but I don't think I can help you much more on this one.

Hopefully someone else can pick it up and help you.
 
Upvote 0
This is a quick one that I have built for you. It is only a guide and you can use it to guide you in the right direction.

Download from here Link for download

There are 3 Sheet, Sheet2 is hidden and will need a Password to be unhidden.

Sheet1 is a cover and Blank, workbook will always open on sheet1

Sheet 2 is hidden and this will need a Password to unhide, this is where your data will go. It will re-hide when workbook is closed
View attachment 13503

Sheet3 Records the attempts users made to login Sheet is PASSWORD PROTECTED cell are locked = Password123, if you change THIS password you will need to do it throughout the whole code, as it is in several places.
View attachment 13501

There are 2 userforms.

Form1 is the login form, input Name and Password. Password is case Sensitive, I think.
View attachment 13500
Login, Name is only for your record, Password is my name Sharid. This is in Column "O" Sheet3 and is Hidden

Reset, Use same form, Password is UnLockMe It may be case sensitive I can't remember. Now Click the reset Button. and column "O" will unhide. Type in new password in Cell "O2"

Before...............................................After
View attachment 13504 View attachment 13506

Only Column "O" cells are unlocked all others are locked. YOU CAN NOW CHANGE THE PASSWORD.

If you want to change the reset password from UnLockMe to some thing else then you have to show column P as it too is hidden in sheet3
View attachment 13508
Click on Unlock Sheet column "P" click on the text in BLUE
View attachment 13509

Type Sheet Password = Password123
View attachment 13510

If you forget to hide the columns, that does not matter as the code will do it for you when it closes the workbook.

To change the sheet Password which is Password123 you will need to do this throughout the code as it is in several places.

Hope this helps and guides, as I have only built this as a guide for you. Sorry but I don't think I can help you much more on this one.

Hopefully someone else can pick it up and help you.
A big thank you for your time and effort, will try to implement it. (y):)
 
Upvote 0
I ended up solving my problem with this VB script!
VBA Code:
Hi,
 can i protect entire workbook with this code? ...if yes...how?
Second the user change the passwort has he wish?

Need a simply solution with passwort entry who the user can change the passwort...only if he knows the old one.
Just save workbook with out change anything there....im a newbie in VBA..

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim MySheets As String, Response As String
MySheet = "Sheet1"
If ActiveSheet.Name = MySheet Then
ActiveSheet.Visible = False
   Response = InputBox("Enter password to view sheet")
       If Response = "MyPass" Then
           Sheets(MySheet).Visible = True
           Application.EnableEvents = False
           Sheets(MySheet).Select
           Application.EnableEvents = True
       End If
End If
Sheets(MySheet).Visible = True
End Sub
 
Upvote 0
A big thank you for your time and effort, will try to implement it. (y):)
Hi Sharid,

i try your solution but im to new in vba to can realy implement your solution in my workbook...like i already say to jonihann
need a simply solution with passwort entry who the user can change the passwort...only if he knows the old one.
Dont need User Name in the Userform only the passwort with the option to can change thw user that.
Just save workbook with out change anything there....im a newbie in VBA..

I would like to thank everyone and you very much for the effort and time you have invested in my concern.
May you come back many times over.

Thx
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

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