Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    Does any one know of any addin that enables you to add/remove line numbers in your code from within the VBA editor? I find this feature invaluable in locating the line number where an error occurs after code is sent out. There's a great VB6 addin called CodeSmart which does this kind of thing, but is doesn't work in VBA.

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    I take it you manually enter the line numbers then use the hidden, undocumented erl() function in your error routine to tell you the line number, correct?

    I've been working on a sub specific routine that will display the list of subs/functions in a module and allow you to apply line numbers to selected subs. It could be modified to just apply the line numbers to an entire project, but I'm not ready for that...

    ...because I have no code *yet* to remove the line numbers. Ha!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    Kevin--
    Thanks for the response. Yes, I use the erl in my error routine; it's helped me track down a lot of problems from afar. As for inserting/removing the line numbers, sometimes I do it manually, and sometimes, when I've got a spare moment, I just copy the whole module into a VB project and let CodeSmart do its thing. I started writing an addin to do this stuff too, but kept on getting pulled away from it by more pressing matters (like my boss wanting additional features, etc.)

    Dan

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    Can you attach a URL to where you found it?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    Geoff W. Added hyperlinks

    Up until now I never bothered to install the thing so I had to do that first before I could answer this question. I already sent the .zip file to the original poster and he's going to report back on how well it works. I didn't have a need for it at the time but there are so very few VBA add-ins that I just downloaded to see what it's like. I found the URL in the about box:

    <A target="_blank" HREF=http://www.siam-consulting.com/Downloads.htm>http://www.siam-consulting.com/Downloads.htm</A>

    They offer two cool tools: 1) Commandbar Controls ID Browser, and 2) Line Numbering Utilities.

    I installed and ran the Line Numbering tool and it seemed to work just fine.

    Enjoy, Deb <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

  6. #6
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    I found a VBA add-in that adds line numbers to your code.I haven't used it yet and forgot about it until I saw your post. I just now installed it but haven't run it yet. I don't remember where I got it but I was thrilled to see any add-in for VBA as there are so few. Here is part of the readme file:

    - Line Numbering Utilities is a true Microsoft Office COM add-in
    developed in Visual Basic for Applications 6.0. (VBA) and designed for
    the Visual Basic Editor (VBE).

    - Line Numbering Utilities is designed to help VBA developers to
    easily add/remove line numbers to their Microsoft Office VBA projects.
    (Microsoft Office 2000 and XP)

    - The VBE environment is unchanged from its default settings, aside from
    the Line Numbering Utilities menu item added under the Add-ins menu.

    Deb <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  7. #7
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    Deb--

    Sorry it's taken a while to get back on this. I tried the line numbering tool, but ran into some problems. It seems to add the numbers okay, but, at least in Word 2000, it doesn't remove them, even though it says it has.

    Dan

  8. #8
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    OOOOOHHHHHhh, you didn' say you want to "remove" the line numbers as well <img src=/S/sarcasm.gif border=0 alt=sarcasm width=15 height=15>

    I only tried it in Excel but I didn't save the workbook with the numbers so don't know if the numbers couldn't be removed. I'd write the people who created it as from the one e-mail I got from them the seemed very helpful. I'm sure they intended to write a program that let you remove the numbers as well.

    I'm glad it worked for you (sort of).

    Deb <img src=/S/flee.gif border=0 alt=flee width=25 height=25>

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    VBACodePrint is a VBA add-in that allows you to print your code with or without line numbers. You don't have to add them anywhere, the add-in does it when it formats the code for printing. You can find it at <A target="_blank" HREF=http://www.jn-software.com/>http://www.jn-software.com/</A>. There are actually versions for VB, VBA, SQL Server, etc., and none of them is very expensive. If have it for both VB and VBA, and it works very well.
    Charlotte

  10. #10
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Tool to Add/Remove Line Numbers? (VBA)

    Actually I think the originator wanted line numbers for debug purposes not for printing per se. It was to be used when an error is triggered so he knows exactly what line caused it. The tool I told him about is a VBA control that worked just fine to add the numbers but he said he couldn't see how to remove them later. I only tried to add the numbers in Excel, whereas he's using Word.

    But, VBACodePrint is a nice utility to have as well..

    Deb <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Posting Permissions

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