DocAElstein
02-04-2021, 09:55 PM
Position that light grey Boarder line anywhere in the VB Editor
This post is intended to give a quick guide on how to put that thin grey border line at a line of your choice.
This post is a summary concentrating on the practical application with a few examples. Its based on the more detailed posts and Threads referenced below . See those posings for more detailed discussions .
What are we talking about.
A thin grey horizontal boarder of this sort of form
is typically seen in a code window separating main coding sections.
The approximate story , ( and as far as I can tell the only documented , or unofficial Blog info ) , on all this can be approximately summarised as:
_(i) this line separates the first declaring section and any following procedure sections from each other.
_(ii) the point above correlates with what we find programmatically if we try to access those lines in the VB editor: The coding which works suggests any comment lines at or above that boarder line belong to the procedure above that boarder line
_(iii) Comment lines above any procedure lines belong to the procedure below.
The first couple of points seem correct, but the last point is incorrect, at least in a practical sense. ( A theoretician maybe able to makes some argument to “prove” theoretically that the third point is correct, but to all practical purposes you can arrange that the boarder line appears close to anywhere of your choice in between procedures or anywhere of your choice in between the first declaring section and the first following procedure. )
As a practical instruction in placing your grey border line, let us think in terms of how VBA appears (to me) to think when placing its grey border lines
End concept
What is an "End"
This post concentrates on the practical implementation, but never the less, it is easier to do the implementation if first a concept is accepted ( explained in more detail at the referenced post _4 )
This is the concept of what I call an "End"
There is slightly more to that end concept than might be expected. I define 3 end situation,
the first _a) makes obvious sense ,
the second _b) is reasonably acceptable,
but the third _c) is very strange. I myself "invented" this last end type
Here they are explained in detail:
_a) an End ______ type code line: The last line of a routine which is coding: the terminating code instruction.
_b) The last declaration statement at the top of a module
_c) Whether by design or accident, VBA "sees" the next line down after a trailing _ ( in a comment section ) as an “End” :
Schematically like this:
'
' _ _
_______This line is seen as an “End” code line ( but may or may not contain the border Line____ )
'
'
_
You could also possibly consider this pseudo “End” as being a sort of End comment section end. I say that because the above schematic we find works just as this would
'
' _We could think of this case _c) as a _
End comment line_______This line is seen as an “End” code line ( but may or may not contain the border Line____ )
'
'
At this stage, for this summary post you must just accept those 3 "End" types. If we can accept that "End" concept, then we can make this simplified set of steps in determining the border position.
How to determine where your thin grey border line will show
Step 1: VBA looks upwards from the next procedure start, to find an "End"
( If we have no next procedure down, ( as in the case of the final procedure or a module with only declarations ) , we fail at this first attempt. So nothing happens and we get no last border ).
Assume we had a following procedure, and started looking upwards, then…
we will find an "End" .
That "End" line will initially be the place of our grey border line.
( remember for case _c) this is the next line down after the first _ _ _ that we encounter when looking upwards )
Step 2: VBA looks downwards for an empty line, and sets the border one line up from that.
VBA looks downwards for an empty line, and sets the border one line up from that
( if VBA never finds an empty line, ( this would be the case of all the in between lines filled with comments ) , then it fails at this step and the border stays where it is from Step 2 at the "End" line. – so No further action is taken in such a case )
That’s it! Provided you accept the "End" concept then that’s all you need to know, and you can put the border at almost any line of your choice.
Its not really that difficult, but working through a few examples will, I think, help get the message across and consolidate the knowledge
Practical examples
There are some example shown at the referred to posts. But they are a bit hard to see in the forum post format, and note also : Don’t try to copy those forum editor given examples to a code module. - I had to add non existing things to help demonstrate , and those extra things copied across may sometimes effect the actual final result given in a real code window.
Some real examples are shown in the uploaded file. I have 5 modules.
I start with the simplest cases, then go up in complexity.
Ref
http://www.eileenslounge.com/viewtopic.php?f=30&t=31756&sid=a2b69eb1f6fadc6b58051bab76fb88bd
_1 https://excelfox.com/forum/showthread.php/2146-%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%89%e0%a4%97-%e0%a4%95%e0%a5%8b%e0%a4%b6%e0%a4%bf%e0%a4%b6-%e0%a4%95%e0%a4%b0-%e0%a4%b0%e0%a4%b9%e0%a4%be-%e0%a4%b9%e0%a5%88-%d8%a8%d9%84%d8%a7%da%af%d8%b2-%da%a9%db%8c-%da%a9*Trying-Blogs?p=11001&viewfull=1#post11001
_2 https://excelfox.com/forum/showthread.php/2146-%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%89%e0%a4%97-%e0%a4%95%e0%a5%8b%e0%a4%b6%e0%a4%bf%e0%a4%b6-%e0%a4%95%e0%a4%b0-%e0%a4%b0%e0%a4%b9%e0%a4%be-%e0%a4%b9%e0%a5%88-%d8%a8%d9%84%d8%a7%da%af%d8%b2-%da%a9%db%8c-%da%a9*Trying-Blogs?p=11002&viewfull=1#post11002
_3 https://excelfox.com/forum/showthread.php/2302-quot-What%e2%80%99s-in-a-String-quot-VBA-break-down-Loop-through-character-contents-of-a-string?p=11853&viewfull=1#post11853
http://www.eileenslounge.com/viewtopic.php?f=30&t=31756
_4 https://excelfox.com/forum/showthread.php/2146-%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%89%e0%a4%97-%e0%a4%95%e0%a5%8b%e0%a4%b6%e0%a4%bf%e0%a4%b6-%e0%a4%95%e0%a4%b0-%e0%a4%b0%e0%a4%b9%e0%a4%be-%e0%a4%b9%e0%a5%88-%d8%a8%d9%84%d8%a7%da%af%d8%b2-%da%a9%db%8c-%da%a9*Trying-Blogs?p=11006&viewfull=1#post11006
CodeModuleCodeSectionGreyBorderLines.xls : https://app.box.com/s/of0knvg2u3gbcaas1wtwlii1czpyyvnj
Position that light grey Boarder line anywhere in the VB Edito.doc https://app.box.com/s/of0knvg2u3gbcaas1wtwlii1czpyyvnj
This post is intended to give a quick guide on how to put that thin grey border line at a line of your choice.
This post is a summary concentrating on the practical application with a few examples. Its based on the more detailed posts and Threads referenced below . See those posings for more detailed discussions .
What are we talking about.
A thin grey horizontal boarder of this sort of form
is typically seen in a code window separating main coding sections.
The approximate story , ( and as far as I can tell the only documented , or unofficial Blog info ) , on all this can be approximately summarised as:
_(i) this line separates the first declaring section and any following procedure sections from each other.
_(ii) the point above correlates with what we find programmatically if we try to access those lines in the VB editor: The coding which works suggests any comment lines at or above that boarder line belong to the procedure above that boarder line
_(iii) Comment lines above any procedure lines belong to the procedure below.
The first couple of points seem correct, but the last point is incorrect, at least in a practical sense. ( A theoretician maybe able to makes some argument to “prove” theoretically that the third point is correct, but to all practical purposes you can arrange that the boarder line appears close to anywhere of your choice in between procedures or anywhere of your choice in between the first declaring section and the first following procedure. )
As a practical instruction in placing your grey border line, let us think in terms of how VBA appears (to me) to think when placing its grey border lines
End concept
What is an "End"
This post concentrates on the practical implementation, but never the less, it is easier to do the implementation if first a concept is accepted ( explained in more detail at the referenced post _4 )
This is the concept of what I call an "End"
There is slightly more to that end concept than might be expected. I define 3 end situation,
the first _a) makes obvious sense ,
the second _b) is reasonably acceptable,
but the third _c) is very strange. I myself "invented" this last end type
Here they are explained in detail:
_a) an End ______ type code line: The last line of a routine which is coding: the terminating code instruction.
_b) The last declaration statement at the top of a module
_c) Whether by design or accident, VBA "sees" the next line down after a trailing _ ( in a comment section ) as an “End” :
Schematically like this:
'
' _ _
_______This line is seen as an “End” code line ( but may or may not contain the border Line____ )
'
'
_
You could also possibly consider this pseudo “End” as being a sort of End comment section end. I say that because the above schematic we find works just as this would
'
' _We could think of this case _c) as a _
End comment line_______This line is seen as an “End” code line ( but may or may not contain the border Line____ )
'
'
At this stage, for this summary post you must just accept those 3 "End" types. If we can accept that "End" concept, then we can make this simplified set of steps in determining the border position.
How to determine where your thin grey border line will show
Step 1: VBA looks upwards from the next procedure start, to find an "End"
( If we have no next procedure down, ( as in the case of the final procedure or a module with only declarations ) , we fail at this first attempt. So nothing happens and we get no last border ).
Assume we had a following procedure, and started looking upwards, then…
we will find an "End" .
That "End" line will initially be the place of our grey border line.
( remember for case _c) this is the next line down after the first _ _ _ that we encounter when looking upwards )
Step 2: VBA looks downwards for an empty line, and sets the border one line up from that.
VBA looks downwards for an empty line, and sets the border one line up from that
( if VBA never finds an empty line, ( this would be the case of all the in between lines filled with comments ) , then it fails at this step and the border stays where it is from Step 2 at the "End" line. – so No further action is taken in such a case )
That’s it! Provided you accept the "End" concept then that’s all you need to know, and you can put the border at almost any line of your choice.
Its not really that difficult, but working through a few examples will, I think, help get the message across and consolidate the knowledge
Practical examples
There are some example shown at the referred to posts. But they are a bit hard to see in the forum post format, and note also : Don’t try to copy those forum editor given examples to a code module. - I had to add non existing things to help demonstrate , and those extra things copied across may sometimes effect the actual final result given in a real code window.
Some real examples are shown in the uploaded file. I have 5 modules.
I start with the simplest cases, then go up in complexity.
Ref
http://www.eileenslounge.com/viewtopic.php?f=30&t=31756&sid=a2b69eb1f6fadc6b58051bab76fb88bd
_1 https://excelfox.com/forum/showthread.php/2146-%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%89%e0%a4%97-%e0%a4%95%e0%a5%8b%e0%a4%b6%e0%a4%bf%e0%a4%b6-%e0%a4%95%e0%a4%b0-%e0%a4%b0%e0%a4%b9%e0%a4%be-%e0%a4%b9%e0%a5%88-%d8%a8%d9%84%d8%a7%da%af%d8%b2-%da%a9%db%8c-%da%a9*Trying-Blogs?p=11001&viewfull=1#post11001
_2 https://excelfox.com/forum/showthread.php/2146-%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%89%e0%a4%97-%e0%a4%95%e0%a5%8b%e0%a4%b6%e0%a4%bf%e0%a4%b6-%e0%a4%95%e0%a4%b0-%e0%a4%b0%e0%a4%b9%e0%a4%be-%e0%a4%b9%e0%a5%88-%d8%a8%d9%84%d8%a7%da%af%d8%b2-%da%a9%db%8c-%da%a9*Trying-Blogs?p=11002&viewfull=1#post11002
_3 https://excelfox.com/forum/showthread.php/2302-quot-What%e2%80%99s-in-a-String-quot-VBA-break-down-Loop-through-character-contents-of-a-string?p=11853&viewfull=1#post11853
http://www.eileenslounge.com/viewtopic.php?f=30&t=31756
_4 https://excelfox.com/forum/showthread.php/2146-%e0%a4%ac%e0%a5%8d%e0%a4%b2%e0%a5%89%e0%a4%97-%e0%a4%95%e0%a5%8b%e0%a4%b6%e0%a4%bf%e0%a4%b6-%e0%a4%95%e0%a4%b0-%e0%a4%b0%e0%a4%b9%e0%a4%be-%e0%a4%b9%e0%a5%88-%d8%a8%d9%84%d8%a7%da%af%d8%b2-%da%a9%db%8c-%da%a9*Trying-Blogs?p=11006&viewfull=1#post11006
CodeModuleCodeSectionGreyBorderLines.xls : https://app.box.com/s/of0knvg2u3gbcaas1wtwlii1czpyyvnj
Position that light grey Boarder line anywhere in the VB Edito.doc https://app.box.com/s/of0knvg2u3gbcaas1wtwlii1czpyyvnj