As my first official post on this new official website for my add-in, it might be a lengthy one :)
Code optimisation(s):
There are several that I’ve discovered, including a variant of the ‘IF’ command that I didn’t know existed.
First
There’s the condensation of a line of code. I’ve done this before in previous “how can I shrink the code” runs, but due to some “copy & paste coding”, I’d got lazy and had forgotten that I should be doing this.
My Old Code:
CheckProtection If blnProtected = True Then Exit Sub End If
The New Code:
CheckProtection If blnProtected = True Then Exit Sub
That’s three lines of code into one.
Second
This is the new IIF function that I never knew existed in VBA. It is very similar to the IF function that can be used in Excel formulae in that you store a result from a test, based on whether the answer is true or false. I do a *lot* of these kinds of tests in my code, mostly within the generation of the list box contents for the various Inspector-type tools.
My Old Code:
If .Rows.WrapAroundText = True Then strWrapAround = "Y" Else strWrapAround = "N" End If
The New Code:
strWrapAround = IIf(.Rows.WrapAroundText = True, "Y", "N")
That’s five lines of code into a single one. That’s going to help shave quite a few kilobytes off the size of the final release of v2.0 when I’ve gone through the code and fixed them all.
New beta:
There is a new beta available (v2.0 preview) which can be downloaded via the DropBox links on the Beta page. I completely forgot to update the GoogleDrive links, but I will fix that tonight. This will be the version which will have some, but not all of the code optimisations as mentioned above. All being well, there will be a noticeable difference in the size of the release version, compared to this beta.
Download, install and let me know via the Trello board if there are any changes needed.