If you work a lot with Microsoft Office, you can use VBA to make many tasks easier. Sometimes you need to fetch the content of a website and sometimes you need a multiline textbox in a VBA form (UserForm) to enter user data.
The example here shows a userform with a textbox that automatically wraps when the text exceeds the width of the text box.
This is achieved by setting the Multiline Property to True.
Enter does not work with multiline textbox
The problem is that this only happens automatically. You can’t use the Enter or Return key to force the line break when writing. As it is shown in the following example picture, it does not work for the time being.
To do this, we need to adjust another property of the text box. As shown in the image below, we need to set the EnterKeyBehavior property to True.
In combination with Multiline True you can insert line breaks as shown above.
More detailed explanations of the Multiline Property can be found on the Microsoft website.