Serial #

technix

Active Member
Joined
May 19, 2002
Messages
326
Using VBA How would I do the following,

(1) Get the Serial Number from the Computer (e.g. 55235-021-3292727-22741)

(2) Change the # to be reversed (e.g. 14722-7272923-120-53255)

(3) Create 5 different code sets for each section (e.g. 1=f, 2=g, etc)

(4) create a code that checks the code to the reversed serial # then pass true if not pass false

Hope this makes sense

Derrick
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Jim North

MrExcel MVP
Joined
Jun 20, 2002
Messages
791
On 2002-09-18 05:48, technix wrote:
Using VBA How would I do the following,

(1) Get the Serial Number from the Computer (e.g. 55235-021-3292727-22741)

(2) Change the # to be reversed (e.g. 14722-7272923-120-53255)

(3) Create 5 different code sets for each section (e.g. 1=f, 2=g, etc)

(4) create a code that checks the code to the reversed serial # then pass true if not pass false

Hope this makes sense

Derrick

I'll try to help with the first two:

1) check out this post:
http://groups.google.com/groups?hl=...ta=group%3Dmicrosoft.public.excel.programming

2. use the strReverse function


I'm not sure what you want in 3.
_________________
JRN

Excel 2000; Windows 2000
This message was edited by Jim North on 2002-09-18 07:00
 

technix

Active Member
Joined
May 19, 2002
Messages
326
On 2002-09-18 06:55, Jim North wrote:
On 2002-09-18 05:48, technix wrote:
Using VBA How would I do the following,

(1) Get the Serial Number from the Computer (e.g. 55235-021-3292727-22741)

(2) Change the # to be reversed (e.g. 14722-7272923-120-53255)

(3) Create 5 different code sets for each section (e.g. 1=f, 2=g, etc)

(4) create a code that checks the code to the reversed serial # then pass true if not pass false

Hope this makes sense

Derrick

I'll try to help with the first two:

1) check out this post:
http://groups.google.com/groups?hl=...ta=group%3Dmicrosoft.public.excel.programming

2. use the strReverse function


I'm not sure what you want in 3.
_________________
JRN

Excel 2000; Windows 2000
This message was edited by Jim North on 2002-09-18 07:00

Thank you for the reply I will check it out,

What I want in 3 is the following

lets say the number was 55235-021-3292727-22741

and I used the revserse command you mentioned and made it 14722-7272923-120-53255

then I want to take each group,

14722 and assign a code value to it like a=5, b=6, c=7, d=8, etc and then a new value for the next group and then the next then the next then the next so each group of numbers has a letter code to it, then I want to assign this letter code a new coding system and generate an unlock code, which will check the unlock code against the serial if they match then it registers the program

does this make any sense?

Derrick
 

ChrisUK

Well-known Member
Joined
Sep 3, 2002
Messages
675
Try these two UDF's

Function CodeIt(r As Range, CodeOffset)

sNewString = ""
For Each c In r
sCellToCode = StrReverse(c.Value)
For x = 1 To Len(sCellToCode)
sNewString = sNewString & Chr(Asc(Mid(sCellToCode, x, 1)) + CodeOffset)
Next
Exit For
Next

CodeIt = sNewString

End Function

Function UnCodeIt(r As Range, CodeOffset)

sNewString = ""
For Each c In r
sCellToCode = StrReverse(c.Value)
For x = 1 To Len(sCellToCode)
sNewString = sNewString & Chr(Asc(Mid(sCellToCode, x, 1)) - CodeOffset)
Next
Exit For
Next

UnCodeIt = sNewString

End Function
 

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959

ADVERTISEMENT

You could use the SUBSTITUTE worksheet function, like this

MyStr = Application.Substitute(MyStr,1,"a")
MyStr = Application.Substitute(MyStr,2,"b")
...
 

Jim North

MrExcel MVP
Joined
Jun 20, 2002
Messages
791
14722 and assign a code value to it like a=5, b=6, c=7, d=8, etc and then a new value for the next group and then the next then the next then the next so each group of numbers has a letter code to it, then I want to assign this letter code a new coding system and generate an unlock code, which will check the unlock code against the serial if they match then it registers the program

does this make any sense?

Derrick

Ok... if your encryption scheme for set 1 is:

<pre>
0 Z
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I
</pre>

then 14722 would be ADGBB... is that what you are trying to do... and then de-crypt it for testing?
 

technix

Active Member
Joined
May 19, 2002
Messages
326

ADVERTISEMENT

On 2002-09-19 06:31, ChrisUK wrote:
Try these two UDF's

Function CodeIt(r As Range, CodeOffset)

sNewString = ""
For Each c In r
sCellToCode = StrReverse(c.Value)
For x = 1 To Len(sCellToCode)
sNewString = sNewString & Chr(Asc(Mid(sCellToCode, x, 1)) + CodeOffset)
Next
Exit For
Next

CodeIt = sNewString

End Function

Function UnCodeIt(r As Range, CodeOffset)

sNewString = ""
For Each c In r
sCellToCode = StrReverse(c.Value)
For x = 1 To Len(sCellToCode)
sNewString = sNewString & Chr(Asc(Mid(sCellToCode, x, 1)) - CodeOffset)
Next
Exit For
Next

UnCodeIt = sNewString

End Function

Chris Thank you for the coding, I am still learning and would like to know if you could explain how this works and exactly how to use it?

Derrick
 

technix

Active Member
Joined
May 19, 2002
Messages
326
On 2002-09-19 06:37, Jim North wrote:
14722 and assign a code value to it like a=5, b=6, c=7, d=8, etc and then a new value for the next group and then the next then the next then the next so each group of numbers has a letter code to it, then I want to assign this letter code a new coding system and generate an unlock code, which will check the unlock code against the serial if they match then it registers the program

does this make any sense?

Derrick

Ok... if your encryption scheme for set 1 is:

<pre>
0 Z
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I
</pre>

then 14722 would be ADGBB... is that what you are trying to do... and then de-crypt it for testing?

Yes, and then the next set of numbers after the hyphen would be a new scheme

Derrick
 

technix

Active Member
Joined
May 19, 2002
Messages
326
since I have xl97 the StrRevers is not available so I am using this code that I found

Code:
Function Reversed(originaltext As String) As String 
Dim i As Integer 
For i = Len(originaltext) To 1 Step -1 
Reversed = Reversed & Mid(originaltext, i, 1) 
Next i 
End Function

to do the reverse
 

technix

Active Member
Joined
May 19, 2002
Messages
326
On 2002-09-18 05:48, technix wrote:
Using VBA How would I do the following,

(1) Get the Serial Number from the Computer (e.g. 55235-021-3292727-22741)

the following code will do what I want for this part of my question, if there is an easier way please let me know

Code:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Sheets("Setup").Visible = xlSheetVisible
Sheets("setup").Select
Set ws = ThisWorkbook.Sheets("Setup")
Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_OperatingSystem")
For Each obj In wmiObjSet
ws.Range("g19").Select
Selection.Value = Reversed(obj.SerialNumber)
Label1.Caption = Reversed(obj.SerialNumber)
Next obj
Application.ScreenUpdating = True
End Sub

Derrick


_________________
Http://www.cashglow.com/affiliates/technix
This message was edited by technix on 2002-09-19 09:33
 

Forum statistics

Threads
1,144,151
Messages
5,722,801
Members
422,459
Latest member
Chriselff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top