PDA

View Full Version : Solved: Quick Newb Question



grichey
10-24-2007, 03:28 PM
Hello.
What does the _ do? Why is it necessary or what does it tell the system? Example:
ThisWorkbook.VBProject.VBComponents _
(Selection).CodeModule _
.CodePane.Show

Oorang
10-24-2007, 03:37 PM
The _ is a line continuation character. Some languages use a semicolon (";") to designate the end of one command, so you can use any combination of spaces and line breaks. VB/VBA does not allow this. Generally speaking the compiler will assume that when it encounters a line break/carriage return, the command is over. The _ character allows you to continue the command to the next line. It's primary use is to improve readability and it is purely optional.
ThisWorkbook.VBProject.VBComponents _
(Selection).CodeModule _
.CodePane.Show
Is functionally identical to:
ThisWorkbook.VBProject.VBComponents(Selection).CodeModule.CodePane.Show

You may go here for a more detailed article: http://support.microsoft.com/kb/141513

grichey
10-24-2007, 03:40 PM
Thanks. Who marks these as 'solved'? Are we supposed to mention we don't need additional replies?

just curious on the etiquette.

edit: your sig proved most useful.

Paul_Hossler
10-24-2007, 03:42 PM
Go up to Thread Tools above the first post and click the triangle and then the Solved radio button

Paul

Oorang
10-24-2007, 04:06 PM
Hi Grichey,
In principle the OP (original poster) should be the on that marks a thread solved. This is the best practice. In reality many of our users don't so if a mod reviews the post and decides it is solved they may mark it as such. Generally this will happen to newer users the most because mods often assume they just don't know to do it yet. The other way a thread might get cleaned up by a mod is if the user says something obviously indicating they have their answer but still haven't checked it off as solved.