• 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.

Hui

Excel Ninja
Staff member
1. Date > MyDate, Password Known
2. Date > MyDate, Password Unknown

3. Date < MyDate, Password Known
4. Date < MyDate, Password Unknown
 

akinkaraman

Member
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

Last edited:

akinkaraman

Member
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:

JeroenCreemers

New Member
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

JeroenCreemers

New Member
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
 

pankaj SURI

New Member
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
 

jolaoye15

New Member
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?
 

jolaoye15

New Member
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.
 

jsmd01

New Member
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
 

Deepak

Excel Ninja
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.
 

jsmd01

New Member
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.
 

Hui

Excel Ninja
Staff member
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
 
Top