Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,075
- Office Version
- 2019
- Platform
- 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?
If PassWordEntered = "password" Then
With ThisWorkbook
.CustomDocumentProperties("Access").Delete
.CustomDocumentProperties.Add _
Name:="Access", _
Value:="permenent", _
Type:=msoPropertyTypeString, _
LinkToContent:=False, _
LinkSource:=""
End With
End If
Dim testString As String
testString = vbNullString
On Error Resume Next
testString = ThisWorkbook.CustomDocumentProperties("Access").Value
On Error GoTo 0
If testString = "permenent" Then
Call GiveAllAccess
End If
When the correct password is entered, this creates a Custom Document Property and sets it to "permenent".
Code:If PassWordEntered = "password" Then With ThisWorkbook .CustomDocumentProperties("Access").Delete .CustomDocumentProperties.Add _ Name:="Access", _ Value:="permenent", _ Type:=msoPropertyTypeString, _ LinkToContent:=False, _ LinkSource:="" End With End If
Put in a Workbook_Activate routine, this will give All Access if the workbook has the proper custom property value.
Code:Dim testString As String testString = vbNullString On Error Resume Next testString = ThisWorkbook.CustomDocumentProperties("Access").Value On Error GoTo 0 If testString = "permenent" Then Call GiveAllAccess End If