Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

String Concatenation

  • Last UpdatedJul 18, 2023
  • 1 minute read

To concatenate strings in VBA, use the ampersand ( & ) concatenation operator between the strings. Multiple concatenations can occur in the same VBA statement.

Dim strFirstName As String
Dim strLastName As String
Dim strFullName As String
Const strSpaceChar = " "
' note the space character between the quotes
strFirstName = "Colin"
strLastName = "Ramsden"
strFullName = strFirstName &strSpaceChar &strLastName
' concatenates string values

The & concatenation operator does not perform arithmetic, and will convert variable data types to strings for concatenation. For instance, if a variant string and a variant number are concatenated, the result is a string. For more details of variant data types, see Variant Declaration and VBA Data Types.

See Also

Strings

Operators

Control Structures

Related Links
TitleResults for “How to create a CRG?”Also Available in