Create password for permenent access

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,075
Office Version
  1. 2019
Platform
  1. Windows
Is it possible to create a password for a user to have permanent, unrestricted access and not not be prompted for a password again?
 
Yes if you know their username probably best finding out their Network login.
 
Upvote 0
What password are you talking about?

Opening the file, modifying the file, unprotecting the sheet or what?
 
Upvote 0
Code:
Private Sub Workbook_Open()
If Environ("Username") <> "Dave" Then Exit Sub
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
    ws.Unprotect "MyPassword"
Next
End Sub

Remember to create a lock scenario for Before_Close

KR


Dave
 
Upvote 0
When you close the workbook you'll be wanting to lock to down

So

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
    ws.Protect "MyPassword"
Next
End Sub

This way when the user opens and then closes the workbook it is editable only to them
 
Upvote 0
dave3009:
How would that code run if the workbook isn't open yet, and the op isn't looking to unprotect sheets.

I think the op is asking how to create a file open password but give certain users a way to open the file without entering the password.
 
Last edited:
Upvote 0
When you close the workbook you'll be wanting to lock to down

So

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
    ws.Protect "MyPassword"
Next
End Sub

This way when the user opens and then closes the workbook it is editable only to them


Thank you again Dave. This poses a unique question. I have a code that allows users to a trial version of a workbook. Upon expiration, the User is promted for a password for unrestricted access. If the user does not want purchase the workbook, the user deletes the workbook. If the user purchase the workbook, than they enter the purchased password to never be prompted for a password again. I'm not sure, haven't tried to incorporate these codes, but would these code work with what I'm trying to do?
 
Upvote 0
Is it possible to create a password for a user to have permanent, unrestricted access and not not be prompted for a password again?

Hi HOTPEPPER

I will not argue a case but it seems like the OP wants a particular user to be able to open a workbook then have unrestricted access.

By unlocking by Username then locking the user has unrestricted access

If I got the wrong end of the stick I am very sorry,

KR


Dave
 
Upvote 0

Forum statistics

Threads
1,226,864
Messages
6,193,409
Members
453,796
Latest member
rcarvalho

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