Article ID: 119115
Article Last Modified on 10/11/2006
Dim n As Integer
Dim s As String
n = 4 ' numeric
s = "xyz" ' string
vn = 3 ' variant containing a number
vsn = "3" ' variant containing a string that can be coerced
' into a number
vss = "abc" ' variant containing a string that cannot be coerced
' into a number
Performing the following operations produces the following results:
Operation Old Result New Result Note* ------------------------------------------------------------------ n + "abc" compile error run-time error 1 n + "3" compile error 7 2 n + 3 7 7 s + "abc" xyzabc xyzabc s + "3" xyz3 xyz3 s + 3 compile error run-time error 1 vn + "abc" 3abc run-time error 3 vn + "3" 33 6 3 vn + 3 6 6 vss + "abc" abcabc abcabc vss + "3" abc3 abc3 vss + 3 run-time error run-time error vsn + "abc" 3abc 3abc vsn + "3" 33 33 vsn + 3 6 6* Notes:
Keywords: kbprogramming kbprb KB119115