T
Tim Wilson
Product: Excel XP / VBA (US)
Platform: Windows 2000
Issue: When the three characters "..." are read from an
Excel cell into a fixed length string variable, VBA
interprets the string as a single character rather than
three characters. This is a problem for my application.
Here is how you can re-create this issue:
In Excel, put this string in cell A1 "1...1"
In VBA, do the following.
------------------------------
Sub TestRoutine()
Dim strTest As String * 1
strTest = Mid(Cells(1, 1), 2, 1)
MsgBox Asc(strTest)
MsgBox Len(Cells(1, 1).Value)
End Sub
-------------------------------
In the first message box, VBA will display ASCII value
133 -- it should be 46.
In the second message box, VBA displays a string length of
3, it should be 5.
Any ideas how to alter this behavior? Couldn't find a
reference in Microsoft support.
Thanks.
Platform: Windows 2000
Issue: When the three characters "..." are read from an
Excel cell into a fixed length string variable, VBA
interprets the string as a single character rather than
three characters. This is a problem for my application.
Here is how you can re-create this issue:
In Excel, put this string in cell A1 "1...1"
In VBA, do the following.
------------------------------
Sub TestRoutine()
Dim strTest As String * 1
strTest = Mid(Cells(1, 1), 2, 1)
MsgBox Asc(strTest)
MsgBox Len(Cells(1, 1).Value)
End Sub
-------------------------------
In the first message box, VBA will display ASCII value
133 -- it should be 46.
In the second message box, VBA displays a string length of
3, it should be 5.
Any ideas how to alter this behavior? Couldn't find a
reference in Microsoft support.
Thanks.