geekjock
01-29-2008, 08:32 PM
Found this board via google and was hoping if anyone could assist me with this dilemma. I know Excel is not secure but, my clients aren't Excel Savvy, so security breaks are not of concerns.
Private Sub Workbook_Activate()
Dim storedPath As String
On Error Resume Next
storedPath = ThisWorkbook.CustomDocumentProperties("PathCertString").Value
On Error GoTo 0
If storedPath = Application.Path Then
Rem is on right computer
MsgBox "Welcome"
Else
Rem wrong computer, password required
If "password" = LCase(Application.InputBox("Wrong computer. I need password.", Type:=2)) Then
MsgBox "Good password"
Rem remember new path to OK comuter
With ThisWorkbook
On Error Resume Next
.CustomDocumentProperties("PathCertString").Delete
On Error GoTo 0
.CustomDocumentProperties.Add Name:="PathCertString", _
Value:=Application.Path, LinkToContent:=False, Type:=msoPropertyTypeString
End With
Else
MsgBox "Wrong password. Goodbye"
ThisWorkbook.Saved = True
ThisWorkbook.Close
End If
End If
End Sub
I was wondering if it were possible after the client enters the password, captures the users computer's information, the password automatically changes to a password only known by the creator. (Basically have two passwords; a client password & administrator password)
Ex.
If I inform the client what his password would be, he enter's the password I provide to him. After the client enters the password, and opens the file, the client's password automatically changes to the administrator's password. The client will not know my password, therefore, if the file is distributed to another computer, than upon opening the file on the new computer, it will prompt for the administrator's password. (of course, the client or the new user will not know my password, because they would not know the password had changed to my password).
Private Sub Workbook_Activate()
Dim storedPath As String
On Error Resume Next
storedPath = ThisWorkbook.CustomDocumentProperties("PathCertString").Value
On Error GoTo 0
If storedPath = Application.Path Then
Rem is on right computer
MsgBox "Welcome"
Else
Rem wrong computer, password required
If "password" = LCase(Application.InputBox("Wrong computer. I need password.", Type:=2)) Then
MsgBox "Good password"
Rem remember new path to OK comuter
With ThisWorkbook
On Error Resume Next
.CustomDocumentProperties("PathCertString").Delete
On Error GoTo 0
.CustomDocumentProperties.Add Name:="PathCertString", _
Value:=Application.Path, LinkToContent:=False, Type:=msoPropertyTypeString
End With
Else
MsgBox "Wrong password. Goodbye"
ThisWorkbook.Saved = True
ThisWorkbook.Close
End If
End If
End Sub
I was wondering if it were possible after the client enters the password, captures the users computer's information, the password automatically changes to a password only known by the creator. (Basically have two passwords; a client password & administrator password)
Ex.
If I inform the client what his password would be, he enter's the password I provide to him. After the client enters the password, and opens the file, the client's password automatically changes to the administrator's password. The client will not know my password, therefore, if the file is distributed to another computer, than upon opening the file on the new computer, it will prompt for the administrator's password. (of course, the client or the new user will not know my password, because they would not know the password had changed to my password).