Using the Str Function to Convert a Value to a String : Data Type Convert « Data Type Functions « VBA / Excel / Access / Word






Using the Str Function to Convert a Value to a String

 
Sub Age()
    Dim intAge As Integer, strYourAge As String
    intAge = InputBox("Enter your age:", "Age")
    strYourAge = "Your age is" & str(intAge) & "."
    MsgBox YourAge, vbOKOnly + vbInformation, "Age"
End Sub

 








Related examples in the same category

1.VBA's Functions for Simple Data Conversion
2.Use CInt to convert input value to integer
3.VBA's Functions for Complex Data Conversion
4.Using the Asc Function to Return a Character Code