About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Troubleshooting
Problem
A type mismatch error occurs when converting a numeric string with a comma (for example, 1,234.32) to a number: Runtime error '13' - Module ScriptName, Line LineNumber Type mismatch error
Cause
The CDbl, CInt, CLng & CSng commands cannot convert a string that uses a
comma as the thousand separator character.
Resolving The Problem
Strip the commas from the numeric string and convert the comma-free numeric string.
Here is a sample script:
Sub Main
Dim Result As Integer
Dim StringNumber As String
Dim SecondStringNumber As String
Dim TempString As String
Dim LengthStringNumber As Integer
Dim x As Integer
Dim Number As Double
StringNumber = "2,141,500.32"
LengthStringNumber = Len(StringNumber)
x = 1
'Creates a new numeric string without commas
Do While x <= LengthStringNumber
TempString = Mid(StringNumber, x, 1)
If TempString <> "," Then
SecondStringNumber = SecondStringNumber & TempString
End If
x = x + 1
Loop
'Converts the new string to a number
Number = CDbl(SecondStringNumber)
End Sub
[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002;2002.05.00;2002 Release 2;2002.05.20;2003;2003.06.00;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Historical Number
121890263
Was this topic helpful?
Document Information
More support for:
Rational Robot
Software version:
2002, 2002.05.00, 2002 Release 2, 2002.05.20, 2003, 2003.06.00, 2003.06.12, 2003.06.13
Operating system(s):
Windows
Document number:
74109
Modified date:
16 June 2018
UID
swg21120992