CSTR(expression)

Returns the expression converted to a string data type (String).


expressionThe expression to evaluate and convert to a string,

REMARKS
* If the expression passed to the function is outside the range of the data type being converted to, an error occurs.
* You can use the STR function if you want to return a numerical values as a string.
* When the expression is a number this function is identical to the STR function.
* If the expression is a boolean it returns the corresponding string representation "True" or "False".
* If the expression can be interpreted as a date it returns a string representation of that date.
* For numbers its just the value as a string (for example "25").
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print CStr(100) 
Debug.Print CStr(10 * 10)

Dim dbValue As Double
dbValue = 100.1234
CStr(dbValue) = "100.1234"

dbValue = 0.123
CStr(dbValue) = "0.123"

Debug.Print CStr("400 pence")
Debug.Print Str("400 pence") 'error

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top