Spreadsheet.ConcatenateVariables

This function Concatenates multiple variables' values into one variable, either a new variable or an existing one. TextOperationFlags can be combination of enum TextOperation values, either one set of flags or an array, 1 per variable.

Syntax Parameters Return Value
Sub Spreadsheet.ConcatenateVariables( _
    varList As Variant, _
    destVarOrInsertAfter As Integer, _
    Optional createNewVariable As Boolean = True, _
    Optional TextOperationFlags As Variant, _
    Optional prefix As String = "", _
    Optional separator As String = "")
  • varList [in]

Which variables to join.

Type: Variant

  • destVarOrInsertAfter [in]

The destination of the new variable. If the createNewVariable parameter is set to True a new variable will be created, otherwise the new variable will be inserted after this variable.

Type: Integer

  • createNewVariable [in,optional]

Whether or not to create a new variable to store results in.

Type: Boolean

Default value: True

  • TextOperationFlags [in,optional]

Variant value specifying any text operations to be performed on the concatenated values.

Type: Variant

  • prefix [in,optional]

The prefix to be added to each value in the resulting variable.

Type: String

Default value: ""

  • separator [in,optional]

The separator to be used to separate the concatenated values in the resulting variable.

Type: String

Default value: ""

This function does not return a value.

SVB Example

Concatenating variables:

Option Base 1
Option Explicit
Sub Main
    'concatenate variables 1 and 3 into a new variable, appended to the end of the dataset
    'the string "Concat" is added to the beginning of each variable
    'the concatenated variable values will be uppercased and separated by a ;
    ActiveSpreadsheet.ConcatenateVariables(Array(1,3),ActiveSpreadsheet.NumberOfVariables,True,scToUpper,"Concat",";")
End Sub