Hi everyone,
I have a form with a large text box. The text box is visible but can not be keyed in, so it has the following settings:
Visible = Yes, Enabled = No, Locked = Yes
The text box is also several lines deep. I have some VBA code within a form module that places some structured text into this text box using a For-Next loop.
The code is essentially like this:
Dim strVBAIncrementalText(4) As String
Dim strVBARequiredText As String
Dim lngVBACount As Long
strVBARequiredText = ""
For lngVBACount = 1 To 4
strVBARequiredText = strVBARequiredText & strVBAIncrementalText(lngVBACount) & Chr(10)
Next lngVBACount
Me.txtRequiredText = strVBARequiredText
So by using the Chr(10) (linefeed character), I am trying to make it go to a new line for each piece of incremental text. However, the new line is not being actioned. The four pieces of text are just being placed end-to-end along the same line (subject to the usual wrapping within the text box).
Incidentally, in the text box, I've tried setting the 'Enter Key Behavior' attribute to 'New Line In Field', but this has no effect. In any case, I assume this would apply only if text were actually being typed into the text box, which is obviously not the case here.
Can anyone suggest how I can make each piece of incremental text start on a new line in the text box?