Text Documents (Writer)
HTML Documents (Writer Web)
Spreadsheets (Calc)
Presentations (Impress)
Drawings (Draw)
Database Functionality (Base)
Formulae (Math)
Charts and Diagrams
Macros and Scripting
Office Installation
Common Help Topics
OneOffice Logo

CStr Function

Converts a numeric expression to a string expression.

Syntax:


CStr (Expression)

Return value:

String

Parameters:

Expression: A valid string or numeric expression that you want to convert.

Expression Types and Conversion Returns

Boolean : String that evaluates to either True or False.
Date : String that contains the date and time.
Null : Run-time error.
Empty : String without any characters.
Any : Corresponding number as string.

Zeros at the end of a floating-point number are not included in the returned string.

Error codes:

5 Invalid procedure call

Example:


Sub ExampleCSTR
Dim sVar As String
    MsgBox CDbl(1234.5678)
    MsgBox CInt(1234.5678)
    MsgBox CLng(1234.5678)
    MsgBox CSng(1234.5678)
    sVar = CStr(1234.5678)
    MsgBox sVar
End Sub