Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Wrap in VBA Editor 2

Status
Not open for further replies.

kabushnell

Technical User
Jun 4, 2003
81
0
0
US
Is there a way to set up word wrap in Visual Basic for Applications editor so when you have a long code it all appears on the monitor. I can't seem to find an option for it. I have been able to do it using Visual Studio.
 
As far as I know, It's the manual way, _
you use the line continuation marks _
(underscore) at the end of the lines so that VBA _
interpret several lines as one _
just remember to use one SPACE before _
the underscore

"If you need to perform this on concatinated " & _
"strings, as in sql statements etc " & _
"also remember appropriate spaces, and " & _
"the string concatination operator"

Roy-Vidar
 
In VBA there is no Word Wrap option as such.

What you can do is use the Line continuation characters to break the code up into a number of lines. At the point in the code where you want to "wrap" to the next line, type in <space><underscore> (" _"). Then start typing on the next line. Depending on what and where you break your code, you may need to start the new line with a concatenation character (&).

For example, to wrap the text displayed in a message box

Code:
msgbox("this is a really long message in a message box" _
       & " so I'll break it in the middle of the text", _
       vbOKOnly, "Long Message")

HTH
Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top