Monday 27 March 2017

AET VBE Tools 1.7.1

It has been a busy couple of weeks, but I added some new features to my VBE tools.

Line Continuation
Here's a pic of what's available.



My version of line continuation adds spaces and underscores after And and Or keywords.

So something like
If Left$(LTrim$(.Lines(lCodeLine, 1)), 4) = "Sub " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Private Sub " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 11) = "Public Sub " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 9) = "Function " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 17) = "Private Function " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 16) = "Public Function " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Property " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Private Property " Or Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Public Property " Then

becomes
If Left$(LTrim$(.Lines(lCodeLine, 1)), 4) = "Sub " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Private Sub " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 11) = "Public Sub " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 9) = "Function " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 17) = "Private Function " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 16) = "Public Function " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Property " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Private Property " Or _
Left$(LTrim$(.Lines(lCodeLine, 1)), 12) = "Public Property " Then


Much easier to read. But there are 2 things to watch out for.

1. If And or Or is between quotation marks, an error will occur. If this happens, click Undo last operation.

The best way to check for errors is to use Compile VBA Project at the top of the Debug menu after adding line continuation.

2. I haven't experienced problems myself, but I occasionally read about people whose code doesn't work properly if there is too much line continuation in a project. Something to keep this in mind anyway. Again, I recommend compilation of code and saving your work at regular intervals in case things go wrong.

New Cleanup Project Options
In addition to deleting excess blank lines (if you have several blank lines between code, only one will remain), you can now choose to delete all blank lines too. Not only that, you can delete comments and indenting.



Personally, I like to have blank lines between regular code and indenting for readability, as well as comments to keep track of what is going on. But when the code is ready for distribution, the 3 new options can drastically reduce the size of your project which is definitely a good thing.

Download the tools here.

P.S. Tick the G+1 icon at the bottom of my post to tell me if you like what you see!

Note: Thanks to everyone who participated in the Facebook sharing event. All good things come to an end, and the offer is now closed! (Don't forget to send your email address so I can send a copy of the tools. My email address is on the blog sidebar).

2 comments :

  1. Hi Andrew, this Line Continuation feature is a great improvement to the Tool.
    Great!

    ReplyDelete
    Replies
    1. Thanks Kellsens. It certainly helps making code easier to read.

      Delete