Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Automatically indenting VBA code.

Automatically indenting VBA code.

Automatically indenting VBA code.

I am on Office 2010, and years ago in an earlier version, I used to be able to use add-ins while I was using the VBA editor. This was for things like automatically formatting the program code with indents, etc.

However, now there don't seem to be any add-ins available. When I go to the Microsoft sight that refers to these add-ins, the link just takes me to a generic download page. But, I have been unable to find these add-ins there. Another site refers to the default add-ins that were included with VBA in office. But, again, I have not been able to find these add-ins. A general internet search tends to give me a million responses about adding add-ins to specific applications like Excel. I have attempted to filter those out, but have not succeeded in my search for information on this.

It may be that Microsoft took them away, in hopes that adding annoyances will somehow encourage the user to upgrade to a more current. though for me, manufacturing these annoyances is no way to make people think that being your customer is a good thing. But, they have certainly done this with the Window 10 nag, and even tricked many into installing it.

I have also been hesitant to get this sort of tool from a 3rd party, for fear of getting infested with a virus. I have seen one paid version, but none free.

Can anyone tell me how to get these add-ons from Microsoft into my VBA editor? Or alternatively, a source for a free plug-in.

Thank you very much,


RE: Automatically indenting VBA code.


I've always used the native VB Editor features. I like to indent (TAB) based on code structures. So when I use an If...Then...Else...End If, I add the entire structure immediately as...


   If a = b Then


   End If 

...and then fill in the True and False required code.

Likewise for With...End With, For...Next, Select Case...End Select, etc. Code the structure first. Fill in between next.

Therefore, I rarely get into the bind of trying to find a missing End If, for instance. And I have never wanted for anything more "automatic."


glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Automatically indenting VBA code.

The only exception to Skip's opinion would be to format somebody else's code, which I have done on many occasions just to see what the heck is going on in the code / logic. Which is not a big deal - highlight a portion of code and hit Tab (Shift-Tab moves the code 'backwards'- to the left)

cadcoke5 - why do you need the 'automatic' way to format VBA code?

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Automatically indenting VBA code.

When structuring someone else's code or not, one can Select multiple lines of code and then TAB or SHIFT TAB to indent/unindent blocks of code.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Automatically indenting VBA code.

Thank you all for the replies.

In regards to taking away things that originally were part of a program, even if they were not put onto the individual's hard drive is dishonest. That is selling a product, and then taking part of it away. It's like selling someone a car, but putting an expiration date on when the radio will be disabled. I suppose it is OK if you warn the customer in advance. But, if you don't make this perfectly clear, you are cheating the customer.

In my case, I was aware of the options for formatting my VBA code that you all have mentioned Right now, I am doing a lot of editing of my own code. The challenge is when there is extensive editing, and you want to make sure you got your nested loops correct, and didn't miss something. That is when the automatic indenting is useful.


RE: Automatically indenting VBA code.

I don't recall Office ever coming bundled with such tools for VBA. Perhaps you could provide a link that shows what used to be included.

RE: Automatically indenting VBA code.

Sorry, I don't recall the details. However, one of the pages I came across on Microsoft's web site did refer to them as being available from Microsoft. The link they provide just doesn't take you to any web page that has them. Rather it takes you to a generic download page. But, that page's search tool does not seem to provide any add-ins for VBA. That is why I was speculating that it was quietly taken away.


RE: Automatically indenting VBA code.

For VBE in excel only you can use AET VBE Tools, a plain excel (xlam) add-in by Andrew Andrew Enwgirda, excel MVP (one of his tools in https://andrewexcel.blogspot.com/).


RE: Automatically indenting VBA code.

Sorry, I still beg to differ, I've been using and programming the Office applications on Windows since they were individual applications, not a bundle, and before VBA was even included in most of them. At no point do I recall Microsoft ever bundling any tools that might automatically format VBA program code with indents. The closest thing was a tool for helping with code commenting, which was included in the Office 2000 Developers edition. There were 3rd party tools, e.g. Steve Bullen's Smart Indenter, that were available (originally released back in 1998 for all the Office apps that used VBA because they didn't have that functionality, and made available since then because Office VBA IDE continued to lack that specific functionality, although I think last version officially supported was Office 2003), that were available, but Microsoft didn't bundle them with Office. And a quick look at the Wayback Machine certainly seems to confirm my recollections.

Are you quite sure the page you found actually referred to Microsoft add-ins, or perhaps instead to 3rd party add-ins? If the latter, you'll accept, I presume, that Microsoft cannot be held responsible for 3rd party add-ins, and whether they are available for the latest versions of Office or not.

MZ-Tools, mentioned above by MajP, is pretty good (but not free) and these days offers indenting features for VBA (earlier versions only offered it for the full VB programming language development environment)

RE: Automatically indenting VBA code.

I will accept your statement about VBA not having these add-on included, since I am not that experienced.
Perhaps it was a 3rd party one, and I forgot that fact. So, then MS would have no responsibility.

I tried to find the page where I found a link to download some ad-ins, to verify that this really is what it was. But I didn't find it in a few minutes, so just gave up.

There are, however other things, such as in Word, where the ability to search for clip-art was either removed, or simply broke and not fixed. I suppose every cloud service will eventually go away.

Thanks for the replies. At least I know to stop looking.

RE: Automatically indenting VBA code.

>Word, where the ability to search for clip-art was either removed

Um, my copy of Word 2010 still has the ability to search for clip art ...

>I suppose every cloud service will eventually go away

There is that risk.

RE: Automatically indenting VBA code.

It shore would be nice if they did put some effort into VBA. If you work in Visual Studio you can see what is possible. I think VS is a pretty impressive development environment.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close