Same code, different line

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

How do you continue the same line of code on a new line?
Basically instead of having one long line where you would
need to scroll horizontally to see the end, you can have
it spread over a number of lines and only scroll
vertically.

Thanks for your speedy response.
 
Hello Neil,

Code line can be devided by _.
(a space and underbar)

eg.


Code:
--------------------

MyVariable = _
"A" & _
"B" & _
"C"

--------------------
 
Neil said:
How do you continue the same line of code on a new line?
Basically instead of having one long line where you would
need to scroll horizontally to see the end, you can have
it spread over a number of lines and only scroll
vertically.

Thanks for your speedy response.

It's done using underscore:

ActiveWindow.Selection.SlideRange.Shapes _
.AddShape(msoShapeRectangle, 246, _
288, 138, 132).Select
 
Neil,

Your character is the underscore.
Be aware, it must be at the end of the line, must be after a space and you
there is a limit to the number of "line continuations" you're allowed.

Sub testit()
Dim strMyValue As String

strMyValue = _
"How do you continue the same line of code on a new line? " &
vbNewLine & _
"Basically instead of having one long line where you would" &
vbNewLine & _
"need to scroll horizontally to see the end, you can have" &
vbNewLine & _
"it spread over a number of lines and only scroll" & _
"vertically."

MsgBox strMyValue

End Sub
 
Back
Top