I have 2 questions now how do i enter a string in using the asc function
Also how do i convert a decimal number to its hexadecimal equivalent
again any help would be greatly appreciated
Printable View
I have 2 questions now how do i enter a string in using the asc function
Also how do i convert a decimal number to its hexadecimal equivalent
again any help would be greatly appreciated
Asc is good for converting a single character from text to its decimal value.
To convert a string, this is the most efficient way I know:
Code:Private Sub Command1_Click()
Dim ba() As Byte
Dim s As String
Dim i%
s = "abc"
s = StrConv(s, vbFromUnicode)
ba = s
'now you have an array with every character expressed As a Single byte. we just need To extract the value
For i = 0 To UBound(ba)
MsgBox ba(i) 'give Decimal value of Each character
Next
End Sub
Same use hex$ to get hex value:
Code:Private Sub Command1_Click()
Dim ba() As Byte
Dim s As String
Dim i%
s = "hello In hex"
s = StrConv(s, vbFromUnicode)
ba = s
'now you have an array with every character In it
For i = 0 To UBound(ba)
MsgBox Hex$(ba(i)) 'give hex value of Each character
Next
End Sub