Results 1 to 1 of 1

Thread: Position that light grey Boarder line anywhere in the VB Editor

  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,423
    Rep Power
    10

    Position that light grey Boarder line anywhere in the VB Editor





    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 anEndcode 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 anEndcode 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/viewtop...051bab76fb88bd

    _1 https://excelfox.com/forum/showthrea...ll=1#post11001
    _2 https://excelfox.com/forum/showthrea...ll=1#post11002
    _3 https://excelfox.com/forum/showthrea...ll=1#post11853
    http://www.eileenslounge.com/viewtopic.php?f=30&t=31756
    _4 https://excelfox.com/forum/showthrea...ll=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
    Attached Files Attached Files
    Last edited by DocAElstein; 02-04-2021 at 10:06 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

Similar Threads

  1. Formula Editor/Bar in UserForm TextBox?
    By xtinct2 in forum Excel Help
    Replies: 3
    Last Post: 05-23-2017, 12:35 AM
  2. Editor Formating Test
    By DocAElstein in forum Test Area
    Replies: 8
    Last Post: 02-02-2016, 05:39 PM
  3. Replies: 3
    Last Post: 08-15-2013, 01:00 AM
  4. Replies: 2
    Last Post: 07-16-2013, 07:37 AM
  5. VBA editor auto-deletes spaces at the ends of lines
    By LalitPandey87 in forum Excel Help
    Replies: 0
    Last Post: 06-26-2012, 07:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •