Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Licence help wanted
Hallo,
Could someone please point me to a way to do the following: When Excel opens a dialogue box appears (which is working). This then check for a file on the computer and then Case 1 : No file (contact me for a serial #) Case 2 : File exists containing a serial # that has expired (Contact me for a serial #) Case 3 : File found and valid (Application continues to run) Case 4 : Temporary #eg "999" will run the application but can only be used 10 times) I then want to have a licensing system where each month i have to supply some serial # to allow access. Could somebody plz suggest such a way to do this in VBA. Many Thanx |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Licence help wanted
NorwichH8R,
The way I handle licensing, renewal notifications, expirations, and re-licensing, is by using Windows Explorer, click on your workbook, and select properties. You'll see three tabs marked General, Custom, and Summary. Select Custom and define a couple of attributes like License, Expiration, and whatever else, and give them some initial settings. Then in the bowels of your program code reference them through instructions like With ActiveWorkbook.CustomDocumentProperties ExpirationDate = .Item("Expiration").Value 'code here to compare the expiration date against today's date and issue a notification message, or deny access if the expiration date has passed LicenseNumber = .Item("License").Value 'code here to test validity of license number and compatibility with expiration date When users renew their license, send them the new expiration date and revised license number that they use to update the previous ones. You can have them do this manually, because even if they see where the new extended expiration date goes, the new license number must be in agreement with it. Naturally, your program code must be locked, and even though it's possible to break, 99% of your users will not want to attempt doing so. -- Dennis Eisen |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Licence help wanted
Thanks for the reply.
I was thinking of using "String Slicing". So for example : My Master Serial Number would be for example : ABCDE12345FGHIJ67890 Then use some function that checks say thus, On a Tuesday then the 1st character in the supplied serial # must b the the 2nd character from the left the master string eg. "B" On a Monday it would be the 1st character from the left the maste string eg. "A" So if it was a Wednesday. the Serial would resemble this, Cxxxxxxxx Then if it is September then i would use the 9th character from the en of the Master serial key which would be G. So if i supplied the serial it must be applied on the day it wa requested and would be in the case of a Tuesday in September a follows, CGxxxxxxxx etc. Obviously i would use other things like Day and year etc. Does this sound ridiculous ? Any advice (including example code if possible) would be most welcom and appreciated. : -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Licence help wanted
Forgot to add the last digits would be generated which would specify th
Expiry Date. So when the application runs in then checks the serial # (which woul need to be read from a file eg "serial.lic" but would contain th serial # i generated for the month) and if the last 5 digits which ar made from similar to previous but this time would specify the expiry . Therfore Tuesday in september would look like this: xxxxxxxxCG and if it is the date of expiry than before closing the application delete the file or similar which when run again would ask for a ne serial #. Basically i want to code a Key Generator application into m application. Obviously i would also need the code to actually produce the Serial as well. As i am not sure if this is feasable could anyone suggest another wa of doing this sort of registration process. Thankyou all in advance -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Licence help wanted
Here is a piece of code i found which does what i want-ish.
Trouble is the guy who did it for me is now long gone !!!! Anyone help?? Because iy had no ' labelling so i can't follow it. Many thanks Option Explicit Sub RegFrm_CheckLicence(Optional bLicenced, Optional bReport, Optiona strPath) Dim strtemp As String Dim lKey1 As Long Dim lKey2 As Long Dim lKey3 As Long Dim dDate1 As Variant Dim dDate2 As Variant Dim dDate3 As Variant Dim Date1 As Date Dim Date2 As Date Dim Date3 As Date Dim i As Integer bLicenced = True If IsMissing(bReport) Then bReport = False If IsMissing(strPath) Then strPath = ThisWorkbook.Path "\serial.lic" Application.StatusBar = "Checking program licence" If Not FileExists(strPath) Then strtemp = InputBox("Please contact IT administrator for licenc number and enter below", "MESG Licence") If strtemp = "666" Then bLicenced = True i = GetSetting("RegFrm", "Valid", "Count", 10) SaveSetting "RegFrm", "Valid", "Count", i - 1 If i <= 0 Then bLicenced = False Else If i = 1 Then MsgBox "You have " & i & " trial of this softwar left!" & vbCr & "Contact xyz inc for a licence number", vbExclamation AppName Else MsgBox "You have " & i & " trials uses of thi application left!", vbExclamation, AppName End If End If GoTo Crash_Out Else If Len(strtemp) < 18 Then MsgBox "Licence number invalid", vbCritical, "MES Licence" bLicenced = False GoTo Crash_Out Else Close #1 Open ThisWorkbook.Path & "\serial.lic" For Output A #1 Print #1, strtemp Close #1 End If End If End If Close #1 Open strPath For Input As #1 Input #1, strtemp Close #1 If Len(strtemp) = 18 Then lKey1 = 723456 lKey2 = 431007 lKey3 = 328888 dDate1 = Val(Mid(strtemp, 1, 6)) dDate2 = Val(Mid(strtemp, 7, 6)) dDate3 = Val(Mid(strtemp, 13, 6)) dDate1 = lKey1 Xor dDate1 dDate2 = lKey2 Xor dDate2 dDate3 = lKey3 Xor dDate3 dDate1 = Format(dDate1, "000000") dDate2 = Format(dDate2, "000000") dDate3 = Format(dDate3, "000000") Date1 = CDate(Mid(dDate1, 1, 2) & "/" & Mid(dDate1, 3, 2) & "/ & Mid(dDate1, 5, 2)) Date2 = CDate(Mid(dDate2, 1, 2) & "/" & Mid(dDate2, 3, 2) & "/ & Mid(dDate2, 5, 2)) Date3 = CDate(Mid(dDate3, 1, 2) & "/" & Mid(dDate3, 3, 2) & "/ & Mid(dDate3, 5, 2)) If bReport Then MsgBox "LIC Creation Date " & Format(Date1, "dd mm yyyy") MsgBox "First Expiry Date " & Format(Date2, "dd mm yyyy") MsgBox "Second Expiry Date (30 days later) " Format(Date3, "dd mmm yyyy") End If If Date3 - Date2 = 30 Then If Now < Date1 Then bLicenced = False ElseIf Now Date3 Then bLicenced = False 'ElseIf Now (Date2 + 28) Then ' MsgBox "Your licence will expire shortly" & vbCr "Contact support...", vbCritical, "MESG Licence" End If SaveSetting "RegFrm", "Valid", "Count", 10 Else bLicenced = False End If Else bLicenced = False End If Crash_Out: Application.StatusBar = "Ready" End Su -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Example Database Licence Agreement | Excel Discussion (Misc queries) | |||
"User Licence" | Excel Discussion (Misc queries) | |||
Just wanted to say thanks! | Excel Discussion (Misc queries) | |||
Distribute Excel Workbook with licence? | Excel Programming | |||
Do I Need Licence to Develop Excel Tools for Sale? | Excel Programming |