Consulting

Results 1 to 8 of 8

Thread: VBA Code Indent

  1. #1

    VBA Code Indent

    Dear All,

    I have got many VBA macros for my day to day use. However, I find it very difficult to read / debug / improve it without it being indented.

    I have found an add-in for Excel at "oaltd.co.uk"

    but it works only upto Excel 2003.

    I am using Excel 2013. Can anyone help me on this.

    Why haven't indentation been added as a default feature by Microsoft ?

    Thanks.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I suppose you could use the Testing forum on the main forum directory. It's at the bottom of the top section.

    Start a thread and in the edit window, on the menu bar, click the green VBA button and paste a module of code between the VBA tags.

    Post the message. Forum software auto indents the code between VBA Tags. Copy the formatted code and paste it back in the module, overwriting the existing unformatted code.

    The VBA(v 2002) Editor Menu >> Tools> Options >> has an auto Indent check. but all it does is match the new line's indent to the previous one's

    The VBA Editor lets you indent and unindent by block, so you can select several lines at once.

    Shift+Tab unindents.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    It is in vb.net. I guess you could copy and paste from vb.net and VBA.

    I doubt that Microsoft would ever put much effort into improving the standard VBE.

    I always indent myself anyway.

    MZ-Tools has some neat features but I don't see an indent tool in it.

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Smart Indenter works in all 32bit versions of Office including 2013.
    Be as you wish to seem

  5. #5
    VBAX Newbie
    Joined
    Apr 2013
    Posts
    2
    Location

    How to get it to work for Office 2013?

    Dear Aflatoon,

    How did you get it to work for Office 2013?
    I can see it in the AddIn Manager of VBA, but when I try to load it the error prompt notifies that the AddIn can't be loaded.

    Thanks.

  6. #6
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Are you using 32bit or 64bit Office? If it's 64bit then the add-in will not work.
    Be as you wish to seem

  7. #7
    VBAX Newbie
    Joined
    Apr 2013
    Posts
    2
    Location
    I am using Office 365 32bit.

  8. #8
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    I don't use 365 so can't comment - all I did was install the add-in and it worked out of the box in 2013 (.msi installation)
    Be as you wish to seem

Posting Permissions

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