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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
You could use the SUBSTITUTE worksheet function, like this

MyStr = Application.Substitute(MyStr,1,"a")
MyStr = Application.Substitute(MyStr,2,"b")
...
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,976
Members
448,934
Latest member
audette89

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
Back
Top