• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to create/generate a licence code for my excel file.

1. Date > MyDate, Password Known
2. Date > MyDate, Password Unknown

3. Date < MyDate, Password Known
4. Date < MyDate, Password Unknown
 
Gosh..! You are right sir. I made the macro expire date as March, it didn't ask password and it didn't open my sheets. :eek:

It works if the date is expired but it doesn't work if the date is not expired. I am turned back. :(
 

Attachments

  • clock.xlsm
    18.3 KB · Views: 507
Last edited:
I think this code finally works fine. :)

Code:
Public MyDate As Variant
Public Passwd As String

Private Sub WorkBook_Open()

MyDate = #2/22/2015#  ' Assign a date.
Passwd = "ABCD" 'Assign password

If Date > MyDate Then

Application.ScreenUpdating = False
Sheets("Intro").Visible = True
Sheets("Clock").Visible = xlVeryHidden
Application.ScreenUpdating = True

MsgBox "Oops! Test/Evaluation period of the utility has been expired." & vbCrLf & _
  "Pls ask the concern person to get the updated utility.", vbCritical, "Outdated/Expired Version"
  mbox = Application.InputBox("Pls input the password/code to continue...", "Password")

  If mbox <> Passwd Then
  MsgBox "Incorrect Password" & vbCrLf & _
  "Pls ask the concern person to get the correct password.", vbCritical, "Wrong password"

Application.Quit
With ThisWorkbook
  .Save
  .ChangeFileAccess Mode:=xlReadOnly
  Kill .FullName
  .Close SaveChanges:=False
  End With

Else
  Sheets("Clock").Visible = True
  Sheets("Intro").Visible = False
  End If

End If


End Sub
 
Last edited:
Hi Guys, i'm new here. I want to add a username to the login. This should should be equal to the username I've added on the Clock sheet in this case ADMIN in cell B1. If not the file should not open. Can you please help?
 

Attachments

  • clock3.xlsm
    21.6 KB · Views: 47
Hi Hui,

I've read the site rules. As this is a extension on the code that is already here I don't think a new topic needs to be started. If you disagree please let me know.

Kind regards,
Jeroen
 
hi ,
could you please help me with an code in excel so that my excel file will automatically expire after a time period set in the code
for example the file should close after 50 hours of usage
 
Wao! that code is very wonderful, and is working perfectly. But Sir, what of if that file is being share with another system or device after the password has been given. will that code still work again?
 
I think this code finally works fine. :)

Code:
Public MyDate As Variant
Public Passwd As String

Private Sub WorkBook_Open()

MyDate = #2/22/2015#  ' Assign a date.
Passwd = "ABCD" 'Assign password

If Date > MyDate Then

Application.ScreenUpdating = False
Sheets("Intro").Visible = True
Sheets("Clock").Visible = xlVeryHidden
Application.ScreenUpdating = True

MsgBox "Oops! Test/Evaluation period of the utility has been expired." & vbCrLf & _
  "Pls ask the concern person to get the updated utility.", vbCritical, "Outdated/Expired Version"
  mbox = Application.InputBox("Pls input the password/code to continue...", "Password")

  If mbox <> Passwd Then
  MsgBox "Incorrect Password" & vbCrLf & _
  "Pls ask the concern person to get the correct password.", vbCritical, "Wrong password"

Application.Quit
With ThisWorkbook
  .Save
  .ChangeFileAccess Mode:=xlReadOnly
  Kill .FullName
  .Close SaveChanges:=False
  End With

Else
  Sheets("Clock").Visible = True
  Sheets("Intro").Visible = False
  End If

End If


End Sub
Well done sir. But i tried to use this code for a file and after the expiring date, i opened that file and there is no any PROMPT.
 
No true protection in Excel : can be bypassed in a few seconds …​
Please explain how you would do this please when a secure password is applied to both the opening sequence within the VBA and also the VBA itself.
thanks
 
Please explain how you would do this please when a secure password is applied to both the opening sequence within the VBA and also the VBA itself.
thanks


Hey! VBA easily possible in XL 2007 while opening password is good stuff but still not power proof for who wish to crack it.
 
Hey! VBA easily possible in XL 2007 while opening password is good stuff but still not power proof for who wish to crack it.
Is there a better suggestion as to how to properly protect your VBA programming from others? Thank you.
 
There are a few systems around that will replace variables with words like

ababababbba and abababababa

Which makes reading and decythering very difficult, but not impossible
 
You could try something like this.

Code:
Private Sub WorkBook_Open()
Dim edate As Date, mbox As Variant, myuser As String, wbuser As String

Application.ScreenUpdating = False
edate = DateSerial(2015, 2, 25)

If Date > edate Then
    MsgBox "Oops! Test/Evaluation period of the utility has been expired." & vbCrLf & _
            "Pls ask the concern person to get the updated utility.", vbCritical, "Outdated/Expired Version"
    mbox = Application.InputBox("Pls input the password/code to continue...", "Password")
        If mbox <> "ABCD" Then ThisWorkbook.Close False
End If
End Sub
Is this password put once or it has to be put every time a document is opened?
 
H
I think this code finally works fine. :)

Code:
Public MyDate As Variant
Public Passwd As String

Private Sub WorkBook_Open()

MyDate = #2/22/2015#  ' Assign a date.
Passwd = "ABCD" 'Assign password

If Date > MyDate Then

Application.ScreenUpdating = False
Sheets("Intro").Visible = True
Sheets("Clock").Visible = xlVeryHidden
Application.ScreenUpdating = True

MsgBox "Oops! Test/Evaluation period of the utility has been expired." & vbCrLf & _
  "Pls ask the concern person to get the updated utility.", vbCritical, "Outdated/Expired Version"
  mbox = Application.InputBox("Pls input the password/code to continue...", "Password")

  If mbox <> Passwd Then
  MsgBox "Incorrect Password" & vbCrLf & _
  "Pls ask the concern person to get the correct password.", vbCritical, "Wrong password"

Application.Quit
With ThisWorkbook
  .Save
  .ChangeFileAccess Mode:=xlReadOnly
  Kill .FullName
  .Close SaveChanges:=False
  End With

Else
  Sheets("Clock").Visible = True
  Sheets("Intro").Visible = False
  End If

End If


End Sub
Hello.

Is there a provision that once you put the password the file can be activated minus asking for the password again?
 
You could try something like this.

Code:
Private Sub WorkBook_Open()
Dim edate As Date, mbox As Variant, myuser As String, wbuser As String

Application.ScreenUpdating = False
edate = DateSerial(2015, 2, 25)

If Date > edate Then
    MsgBox "Oops! Test/Evaluation period of the utility has been expired." & vbCrLf & _
            "Pls ask the concern person to get the updated utility.", vbCritical, "Outdated/Expired Version"
    mbox = Application.InputBox("Pls input the password/code to continue...", "Password")
        If mbox <> "ABCD" Then ThisWorkbook.Close False
End If
End Sub
Thanks for the code it was really helpful but is there a code that allows you to auto renew your licence or expiry period after password is entered for an expired file??
 
This can be , Hope any one will take care of that of not I will glad to help if get free hand for that.
 
Back
Top