Home > Mobile >  VBA - Enter array into multiline textbox on userform
VBA - Enter array into multiline textbox on userform

Time:06-26

I want to enter each element of an array onto a new line in multiline textbox on a userform. I have the Multiline and EnterKeyBehaviour of the textbox set to True.

The code below will enter the array elements but after entered they are then overwritten by the next element.

For i = LBound(clipArray) To UBound(clipArray)
        frmMyForm.txtBox.Text = clipArray(i)
Next

I have tried variations like below (with vbCr, vbCrLf etc) but still does not work.

frmMyForm.txtBox.Text = clipArray(i, vbNewLine)

How can I fix?

CodePudding user response:

Please, use:

   frmMyForm.txtBox.Text = Join(clipArray, vbLf)
  • Related