D
Dave D-C
Option Explicit
' (this must be a standard module)
' I am moveing , e.g., x8C01 (chr$(140) & chr$(1)) into an integer
field.
' I do this by first moving that string into a string field,
' then using LSet to move the string field into the integer field.
' Considering little endian, I expect the integer to be x018C=396.
' Instead, I get 338 (see output row 141). What am I missing?
'Also, see rows 129, 131, etc. I am using Excel97
' Thanks, Dave
Type typI2
i2 As Integer
End Type
Type typS2
s2 As String * 2
End Type
Sub Sub1() ' demonstrate my issue
' Look at rows 129, 131, 141, etc. on output
' Why aren't these as I expect them to be?
Dim recI2 As typI2, recS2 As typS2
Dim i1%, i2%, irow&
i2 = 1 ' this doesn't seem to have any effect
For i1 = 0 To 255
recS2.s2 = Chr$(i1) & Chr$(i2)
LSet recI2 = recS2 ' binary move s2 to i2
irow = irow + 1
Cells(irow, 1) = i1
Cells(irow, 2) = i2
Cells(irow, 3) = recI2.i2
Next i1
End Sub
' (this must be a standard module)
' I am moveing , e.g., x8C01 (chr$(140) & chr$(1)) into an integer
field.
' I do this by first moving that string into a string field,
' then using LSet to move the string field into the integer field.
' Considering little endian, I expect the integer to be x018C=396.
' Instead, I get 338 (see output row 141). What am I missing?
'Also, see rows 129, 131, etc. I am using Excel97
' Thanks, Dave
Type typI2
i2 As Integer
End Type
Type typS2
s2 As String * 2
End Type
Sub Sub1() ' demonstrate my issue
' Look at rows 129, 131, 141, etc. on output
' Why aren't these as I expect them to be?
Dim recI2 As typI2, recS2 As typS2
Dim i1%, i2%, irow&
i2 = 1 ' this doesn't seem to have any effect
For i1 = 0 To 255
recS2.s2 = Chr$(i1) & Chr$(i2)
LSet recI2 = recS2 ' binary move s2 to i2
irow = irow + 1
Cells(irow, 1) = i1
Cells(irow, 2) = i2
Cells(irow, 3) = recI2.i2
Next i1
End Sub