whytheq
whytheq

Reputation: 35557

Applying vbCrLf to the content of a textbox

I've got a userform within an Excel vba project. At design-time it is empty.

In the form initialize event I've got the following code:

Private Sub UserForm_Initialize()

txtSQL.value = _
    "SELECT MyName = ""ColY"" " & vbCrLf & _
    "FROM SomeTable " & vbCrLf & _
    "GROUP BY Customer " & vbCrLf & _
    "ORDER BY Customer DESC"

End Sub

I was hoping for 4 separate lines of text in the textbox but instead have the following:

enter image description here

Am I using the wrong control? Or am I using the right control in the wrong way?

Upvotes: 2

Views: 2782

Answers (1)

whytheq
whytheq

Reputation: 35557

Whoops: maybe I should go to bed...

At design-time set multi-line property to True!

Upvotes: 4

Related Questions