PDA

View Full Version : VBA Code Indent



mailmaverick
03-22-2013, 06:22 AM
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.

SamT
03-22-2013, 07:16 AM
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.

Kenneth Hobs
03-22-2013, 07:47 AM
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.

Aflatoon
03-23-2013, 06:37 AM
Smart Indenter works in all 32bit versions of Office including 2013.

deman
04-11-2013, 03:20 PM
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.

Aflatoon
04-11-2013, 03:42 PM
Are you using 32bit or 64bit Office? If it's 64bit then the add-in will not work.

deman
04-12-2013, 02:38 AM
I am using Office 365 32bit.

Aflatoon
04-12-2013, 02:49 AM
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)