Concatenating
You can use "+" for concatenation although it is not recommended as this is a WordBasic operator. You should use "&".
When using the string concatenation character "&" be sure to insert a space before and after this operator.
String Concatenation (&)
This operator can be used to join two or more strings together.
This operator can also automatically convert between types as it combines a resultant string.
It can be used to combine several different variable types into a string without any explicit conversion.
Dim sMyLongString As String
Dim sShortString As String
sShortString = "Monday"
sMyLongString = sShortString & " " & "some more text"
MsgBox sMyLongString ' = "Monday some more text"
String Concatenation (+)
This can also be used as a string addition operator to join two or more strings together.
If you try to use this operator with multiple variables types you will receive a "Type Mismatch" error.
Dim MyNumber As Variant
MyNumber = "2"
MyNumber = MyNumber + MyNumber + MyNumber
MsgBox MyNumber ' "222"
JOIN Function
JOIN - Returns a text string containing all the elements in an array (String).
Dim aValues() As String
aValues(0) = "string1"
aValues(1) = "string2"
aValues(2) = "string3"
Debug.Print Join(aValues) '= "string1 string2 string3"
Large String Concatenating
When you are concatenating in a large loop, in excess of a few thousand times always use the JOIN function.
' instead of this
Dim myString As String
For i = 1 To 10000
myString = myString & myArray(i)
Next
' use this approach
Dim myString As String
ReDim temporary(1 To 10000)
For i = 1 To 10000
temporary(1) = myArray(i)
Next
myString = Join(temporary,"")
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext