PDA

View Full Version : Solved: Silly Ques: What is the Underscore btwn listed variables?



StlSmiln
06-25-2012, 06:24 AM
I see this a lot but don't know what it means. For example,

Sub ImportTxtData(sPath As String, sName As String, dSheet As Worksheet, _
dRange As Range, Optional tbFieldNames As Boolean = False)
What does that underscore btwn dSheet and dRange mean or do?

CodeNinja
06-25-2012, 06:28 AM
That underscore allows a you to continue the code on the next line.

fredlo2010
06-25-2012, 06:31 AM
Its actually space and underscore.

StlSmiln
06-25-2012, 06:52 AM
So it's just to allow you to hit return and move to the next line so you don't have code running forever?

Why wouldn't the VBE just give you a wrap text option? Is that a lame question? Previously I've only played with Javascript, HTML, and CSS in Notepad++, which allows that option and don't require any special character like that for breaking to a new line.

CodeNinja
06-25-2012, 07:00 AM
Yep, just to hit return and not have 1 line look to ugly.

As far as why no wrap text option? Its the way the code is built... A return means you are done that bit of code... would you prefer to type ; at the end of every statement like in java or c? It is kinda the same thing, but this seems more similar to the English language.

fredlo2010
06-25-2012, 07:07 AM
So it's just to allow you to hit return and move to the next line so you don't have code running forever?

No this is only to make the code easier to read and understand.

Var = Array("this", "that", "never", "how", "when", "where", "do", "so", "maybe", "there", "never")

Var = Array("this", "that", "never", "how", _
"when", "where", "do", "so", _
"maybe", "there", "never")

StlSmiln
06-25-2012, 07:21 AM
Got it! Thanks guys!