MZ-Tools released with several enhancements and bug fixes

Last May 1 a new monthly build of MZ-Tools,, was released. This build continues improving the updating experience initiated some builds ago: first, it provides again a “Download Only” button for those of you who don’t want the new automated update and prefer a manual installation as before. Second, in the automated update, it prevents in many cases the error that happened when some dll was in use, asking you to close the instance of the IDE before updating. And third, it reopens automatically the IDE and the loaded project when the update is finished.

In this build the headers review shows the first line of a header template that causes that the existing header no longer matches that template, which is useful to know why a header review is not passing. It also provides a context menu entry for the Insert Error Handler (VB) or Insert Exception Handler (Visual Studio).

It also introduces a change, in the form of a new requirement: .NET Framework 3.5 (previously only .NET Framework 2.0 was required). But in most cases you won’t need to install it because Windows 7 provides it and on Windows 10 only MZ-Tools 8.0 for Visual Studio 2005 will require it, but not MZ-Tools 8.0 for VBA/VB6/VB5. This new version of the .NET Framework will allow MZ-Tools in the future to use internally better APIs and externally new UI technologies (such as WPF).

Finally, this build fixes quite a few bugs that you have reported during the last month.

The complete changelog is the following:

  • Changed (VS 2005): .NET Framework 3.5 is now required if not running on Windows 7.
  • Changed (VBA/VB6/VB5): .NET Framework 3.5 is now required if running on Windows XP / Vista.
  • Enhanced [#12069] (All): The context menu of the code window now provides the “Insert Exception Handler” / “Insert Error Handler” meny entry.
  • Enhanced [#12113] (All): Added new predefined variable Type Tag With Upper Case ($P[TYPE_TAG_WITH_UPPER_CASE]), useful if your constants use upper case and include a type tag.
  • Enhanced [#12065, #12070, #12071] (All): The setup now shows a better message to close the IDE that is locking a file when updating.
  • Enhanced [#12065, #12070, #12071] (All): The setup now reopens the IDE and project or Office document that was open before closing it for updating.
  • Enhanced [Internal] (All): The Headers Review now shows the line of the header template that causes that the reviewed header doesn’t match it.
  • Fixed [#12068] (VBA): The Code Explorer didn’t respond to changes in the active file after unlocking a password-protected database. Now clicking the Refresh button starts responding.
  • Fixed [#12032] (VBA): In the Control Name Assistant, the Tab key inserted a Tab character in the textbox if a message box was shown (such as invalid name or state loss).
  • Fixed [#12081] (All): System.IO.IOException was not handled gracefully when deploying options files to a folder.
  • Fixed [#12090] (All): The Browse Folder dialog caused COMException 0x80040111 on Windows 7 if themes were deactivated.
  • Fixed [#12096] (VB/VBA): The Headers Review failed in some cases using user-defined variables.
  • Fixed [#12106] (All): The Programming Rules Review didn’t locate the exact code when using the “Any of these values” option instead of the “This value” option and didn’t show all violations.
  • Fixed [#12103] (VBA): The type tag editor and other features didn’t show 32-bit type libraries when using the 64-bit VBA editor.
  • Fixed [#12133] (VS): Shared projects were not supported.
  • Fixed [#12123] (VB6/VB5): Several features such as Find Text could crash a project if it contained many forms due to a leak.
  • Fixed [Internal] (All): The Headers Review didn’t review if there was more text or lines after the lines of a valid header.
  • Fixed [Internal] (VBA): Several features didn’t work correctly with the Page control in some versions of Office.
  • Fixed [Internal] (VBA): The Check for Updates feature of the portable edition offered the Install button when it should offer only the Download button.
  • Fixed [Internal] (VS): Icon of Keyboard Shortcuts in Options window was not correct when using the dark theme.
  • Fixed [Internal] (All): The Programming Rules Review didn’t show a friendly message if some regular expression was not valid.
  • Fixed [Internal] (All): The Programming Rules Review didn’t work in some scenarios using the Any Code Element rule kind.

MZ-Tools released with several enhancements and bug fixes

Yesterday a new build was released. This new build introduces two new columns, Access and Kind, in the Code Explorer:

It also provides a more streamlined updating experience that installs directly the new build without having to download the new setup, save it, locate it, run it, etc.:

There is also a new setting to choose whether to add blank lines or not in the New Method / Property Assistant (previously blank lines were always added):

The complete changelog is the following:

  • Enhanced [#11991] (All): The license file can now be replaced in the About window.
  • Enhanced [#11990] (All): The code element name is now shown in the caption of the Code Template User-Defined Variables Values dialog.
  • Enhanced [#12002] (VB/VBA): Added option to insert or not blank lines in code generated by the New Property/Method Assistant feature.
  • Enhanced [#12003] (VB/VBA): Added scope and kind columns to Code Explorer.
  • Fixed [#11910] (All): The setup shows now an error message to close the IDE that is locking a file.
  • Fixed [#11972] (All): The Options files were not read again once the connectivity with the drive that contained them was restored (USB drive, network folder, VPN, etc.).
  • Fixed [#11975] (All): The Code Explorer could cause NullReferenceException.
  • Fixed [#11993, #11594, #10722] (VBA): The Dead Code Review could cause COMException (0x800A9C68) when retrieving the Name property of a UserForm.
  • Fixed [#12005] (VS 2015): The Dead Code Review could cause System.InvalidOperationException “Ildasm File Full Name is null”.
  • Fixed [#12032] (VBA): The Tab key doesn’t work correctly in the Control Name Assistant. This bug was introduced in build
  • Fixed [#12020] (VB/VBA): The Sort Code Elements feature didn’t allow conditional compilation directives inside properties.
  • Fixed [#12037] (VB/VBA): The New Method/Property Assistant failed when used on a class whose name started with “I” because it is an interface.
  • Fixed [#12036] (VS): The line numbering feature of VB.NET didn’t exclude lines starting with the “Into” keyword.
  • Fixed [Internal] (VS): Some windows were not shown correctly with the Dark theme. This bug was introduced in non-public build
  • Fixed [Internal] (VS/VBA): The Next Item button on the Control Explorer toolbar didn’t have the correct size in high DPI displays.
  • Fixed [Internal] (All): The icons in the explanation zone of the Options window didn’t have the correct color depth.

MZ-Tools released with several enhancements and bug fixes

Today a new build of MZ-Tools has been released with some bug fixes and several important enhancements thanks to your feedback, including a feature of MZ-Tools 3.0 that was not available yet on MZ-Tools 8.0: the ability to save files at debug-time (with a keyboard shortcut). New File/Method properties such as CodeLineCount, CommentLineCount, BlankLineCount, etc. (and the equivalent ones as percentages) have been added to the programming rules review, so that you now can create rules of the type “If you create spaghetti code, at least comment it profusely” :-). If you are a VBA user, toolwindows such as the Code Explorer now refresh automatically when the active window changes. The Insert Header is now more usable: there is a new menu entry on the context menu of the code window, and to insert a header to a file you can now put the cursor at any column of line 1 (not at column 1 as before). Also, the headers can use now two new predefined variables to define a section for the return value of a method or property. The whole section is deleted if the method doesn’t return a value, so you can define a unified header for Sub and Function methods. Finally, this build introduces a more streamlined experience in the Check for Updates feature requiring fewer clicks to update (you will notice this in the next monthly build).

The complete changelog is the following:

  • New (VB6/VB5): Keyboard shortcut to save file at debug-time (this feature was in MZ-Tools 3.0).
  • Enhanced [#11944] (All): Added the following properties to the Programming Rules Review: LineCount (formerly CodeLineCount, which changes the meaning), CommentLineCount, BlankLineCount, CodeLinePercentage, CommentLinePercentage, BlankLinePercentage.
  • Enhanced [#11910] (All): The check for updates process requires now fewer clicks to install the latest version.
  • Enhanced [#11924] (All): The context menu of the code window now provides the “Insert Header” meny entry.
  • Enhanced [#11857] (VBA): Toolwindows (Code Explorer, TabIndex Assistant, etc.) are now refreshed automatically when the active window changes.
  • Enhanced [#11924] (VB/VBA): The Insert Header feature now allows the cursor on any column of line 1 when inserting a class or module header.
  • Enhanced [#11946] (All): Added predefines variables “Method Return Section Begin” and “Method Return Section End” to exclude information about the return type in headers for methods that don’t return a value (“void” in C#, “Sub” in VB, etc.).
  • Enhanced [Internal] (VBA): The portable edition provides the option to isolate or not MZ-Tools, and the Com Shim provides better diagnostics.
  • Fixed [#11957] (VBA): The scope “Open files” didn’t work if the filename contained the “-” character.
  • Fixed [#11902] (All): In the dialog to enter the values of user-defined variables, if the value of a user variable was long enough to show the horizontal scrollbar in the preview richtextbox, the textbox with the value lost the focus.
  • Fixed [#11920] (All): NullReferenceException could happen in some circumstances.
  • Fixed [#11899] (VB/VBA): The Initialize and Terminate methods of classes were not shown in Code Explorer, and no icon was shown for them in the results window. This bug was introduced in build
  • Fixed [#11903] (VB/VBA): Some features such as the Line Indenter caused error with comments that included again the comment character. This bug was introduced in build
  • Fixed [#11958] (VB/VBA): The Insert Error Handler and other features don’t work correctly if the method declaration contains optional parameters initialized with dates or quotes that include the ‘:’ character.
  • Fixed [#11901] (VS): The Results window didn’t locate correctly variables declared with the same name in different blocks of the same method.
  • Fixed [Internal] (VB5/VB6): The main toolbar didn’t show all the buttons when using a resolution of 1280 horizontal pixels due to the new Code Explorer button. Now the Collapse Projects button has been moved to the Other Utilities toolbar. This bug was introduced in build
  • Fixed [#11947, #11954] (VB/VBA): The Code Explorer could cause System.Runtime.InteropServices.COMException (0x80020010): Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE)).

MZ-Tools released introducing enhanced programming rules reviews, enhancements and bug fixes

Today a new build of MZ-Tools has been released with some bug fixes and interesting enhancements:

The Programming Rules Review now shows all violations of rules that use the “Not Containing” and “Not Matching” operators. So, for example, if you don’t want to use the Static modifier in procedure variables, now you get all the occurrences, not only the first one:

More importantly, the Programming Rules Review now allows to define a programming rule that is quite requested: if the code of a method (or module) contains some expression, then the code of that method (or module) must contain also some other expression. For example, if a method opens a recordset, it must close that recordset (or set a variable to Nothing). How this is done will be the subject of a separate post.

For VB/VBA, the Code Explorer and other features now distinguish between procedures that are subroutines (Sub) and procedures that are functions (Function). Notice the new icons and the separate filters:

The Options dialog now uses a more modern dialog to select a folder, that allows you to type (or paste) the full path to the folder:

The complete changelog is the following:

  • Enhanced [#11869] (All): The Programming Rules Review now allows regular expressions backreferences in the Value field of a condition for captures in the value field of a When condition.
  • Enhanced [Internal] (All): The Programming Rules Review now shows all violations using the “Not Containing” and “Not Matching” operators.
  • Enhanced [#11837] (All): On Windows Vista or higher you can now type the location of the options files, with a new folder browser dialog.
  • Enhanced [#11874] (VB/VBA): Features that deal with procedures now distinguish between Subs and Functions.
  • Fixed [#11886] (All): The Private Clipboards dialog now allows to click the OK button by keyboard using Alt+O.
  • Fixed [#11863] (All): The Find Text feature didn’t allow regular expressions when using Multiline.
  • Fixed [#11883] (VB/VBA): The Statistics feature now includes only text files that are recognized text files or parents of code files.
  • Fixed [#11880] (VB/VBA): Event handlers were considered dead code if used all lower case.
  • Fixed [#11866] (VBA): The Insert Header feature can cause NullReferenceException when used with CSS files (which are unsupported).
  • Fixed [#11845] (VBA): The Line Indenter didn’t parse correctly lines with the space + comment character sequence inside a string.
  • Fixed [#11825] (VBA): After inserting a code template, the code window didn’t get the focus.
  • Fixed [#11837] (VBA): On Windows Vista or higher you can now type the location of the options files, with a new folder browser dialog.
  • Fixed [#11858] (VBA): The Database Connection Assistant didn’t show the connection string with the MySQL ODBC driver.
  • Fixed [#11894] (VBA): The scope “Open files” didn’t work in Microsoft Access.
  • Fixed [Internal] (All): The Programming Rules Review caused exceptions if invalid regular expressions were used.

MZ-Tools released introducing a Code Explorer and drag & drop in TabIndex Assistant

Last January 1 another monthly build was released, This time, apart from some bug fixes, it introduces a new feature: a file code explorer:

You can read more about the Code Explorer on this post: Moving from MZ-Tools 3.0 to 8.0 Part 32: A Code Explorer.

Also, support for drag & drop in the TabIndex Assistant is reintroduced (this was supported in MZ-Tools 3.0, but not in MZ-Tools 8.0 until now).

The complete changelog is the following:

MZ-Tools released (January 1, 2017)

  • New (VB/VBA): Code Explorer.
  • Enhanced [#11723] (All): Added support for drag & drop in TabIndex Assistant, Switch Assistant and other listviews.
  • Fixed [#11779] (All): The Programming Rules Review didn’t locate results using regular expressions when the found text ended with carriage return without line feed.
  • Fixed [#11775] (All): The Code Element Headers Review caused “Unterminated [] set” with headers that included parameters of array types.
  • Fixed [#11750] (All): The Generate HTML documentation could cause System.Xml.XmlException: hexadecimal value is an invalid character.
  • Fixed [#11739, #11749, #11757] (VB/VBA): The language of the user interface was always English on Windows 7. This bug was introduced in build
  • Fixed [#11766] (VS): The New Method/Property Assistant added quotes to the initial value String.Empty.
  • Fixed [#11804] (VBA): The Find feature could cause System.ArgumentOutOfRangeException when using the VBA editor with double-byte encondings.
  • Fixed [Internal] (VB): The Generate Documentation (XML/HTML) could cause System.NullReferenceException (“System Error &H80004003. Invalid pointer”) if the operation was executed twice.
  • Fixed [Internal] (VBA): The width of buttons on toolbars was not correct when using high-DPI displays.

Moving from MZ-Tools 3.0 to 8.0 Part 32: A Code Explorer

The build released on January 1, 2017, introduces another very requested feature: a Code Explorer. This feature provides you a list with all the code elements of the active code window:

The Code Explorer shows the code elements of the following kinds:

  • Constants
  • Fields
  • Enums
  • Events
  • User-Defined Types
  • Properties
  • Methods

On the toolbar there are seven toggle buttons to show/hide the code elements of a particular kind. Here you can see the Code Explorer showing only fields:

Furthermore, to the right of the toolbar you have a textbox to enter any text, so that only the code elements containing that text are shown:

And selecting any code element in the list shows it in the code window. I hope that you find this tool productive to locate your code faster!

MZ-Tools and released with VS 2017 RC support and bug fixes

The past November 16 a new build was released with some bug fixes and, more importantly, with support for the Visual Studio 2017 Release Candidate 1 announced by Microsoft at the Connect(); 2016 event.

Today a new build has been released with new bug fixes, one of them specially important if you are using Visual Basic 6.0 since the Rename Related Source Code feature was crashing usercontrols.

Also, this month the MZ-Tools website started to use https and this caused a problem in the Check for Updates feature that is now fixed.

The changelogs are the following:

MZ-Tools released (November 16, 2016)

  • New (VS): Added support for VS 2017 RC.
  • Fixed [#11691] (All): The Generate HTML Output Documentation removed indentation of comments in headers.
  • Fixed [#11662] (All): The Dead Code Review didn’t parse correctly statements that were not Dim declarations in lines that started with Dim declarations.
  • Fixed [#11670] (VB/VBA): The Replace feature could cause System.ArgumentOutOfRangeException “Index and length must refer to a location within the string” could happen in some cases.
  • Fixed [#11666] (VBA): LongLong and LongPtr types were not recognized.
  • Fixed [#11695] (VBA): The TabIndex Assistant and other features duplicated a control if the parent was a Frame control inside another Frame control.

MZ-Tools released (December 1, 2016)

  • Fixed [#11715] (All): The Check for updates feature caused “” not found because of https.
  • Fixed [#11716] (All): The Review Code Element Headers could cause System.ArgumentNullException “Value cannot be null”.
  • Fixed [#11724] (All): MZ-Tools entry is no longer created in Control Panel > Programs and features if silent switches are used for automated deployments.
  • Fixed [#11703, #11704] (VB6): Custom control crashed when renamed if the “Rename Related Source Code” feature was activated.

MZ-Tools released with bug fixes

Today a new build has been released, as every month, with some bug fixes. Now I am working on compatibility with VS “15”.

The complete changelog is the following:

MZ-Tools released (November 1, 2016)

  • Fixed [#11589] (All): The Code Library and other tree-based lists were not sorted ignoring case.
  • Fixed [#11613] (All): The Review Headers did not skip DllImport / Declare methods.
  • Fixed [#11638] (VS): System.NotImplementedException “The method or operation is not implemented.” could happen when using SQL Server Database Projects that reference databases.
  • Fixed [#11601] (VB/VBA): The Ctrl+F keyboard shortcut was not allowed to be assigned to the Find Text feature of MZ-Tools to override the Find feature of VB/VBA.
  • Fixed [#11624] (VB/VBA): The New Property Assistant showed an empty list for headers if both Get/Let-Set radiobuttons were selected.
  • Fixed [#11623] (VB/VBA): The Review Dead Code didn’t ignore parameters of callbacks of Ribbon code.
  • Fixed [#11643] (VB5/VB6): The Find text window and the Results window did not work correctly at debug or run-time.
  • Fixed [#11592] (VBA): “System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to class type ‘System.Windows.Forms.UserControl'” happened if an old version was installed with admin rights and a newer version was installed without admin rights and without uninstalling the previous version.

Introducing MZ-Tools 8.0 for VBA Portable Edition

MZ-Tools 8.0 for VBA, released a year ago, already introduced an innovation in the world of add-ins for the VBA editor allowing to install it without admin rights, something that was quite requested because in many companies users of Office are not admin users (and that’s right).

The build released yesterday, in the first anniversary, introduces yet another innovation in this area: a portable edition. That’s right, you can now run MZ-Tools 8.0 for VBA without running a setup. You can even run it from a USB drive if you want, without copying any file to the hard disk of your computer. This scenario is not so much requested, but it seems that there are companies where users are not allowed (by group policies) to run any kind of setup (even those setups that don’t require admin rights), and maybe even PowerShell or regedit.exe are not allowed either.

So, a portable edition is now provided. The setup edition is still not only provided but also recommended (at least for now). The portable edition is suitable for the scenarios mentioned above.

When you download the portable edition, you get a file that, when unzipped, has this file structure:


There is a MZTools8VBAPortable.exe executable (with a .config file to allow it to run on whatever .NET Framework you have installed, 2.0 or 4.0) and a Files folder, that contains the files (dlls) and the options files (although you can configure the options files anywhere).

When you run the MZTools8VBAPortable.exe file, you get a dialog to register MZ-Tools 8.0 for VBA in the VBA editor:


And, of course, you can unregister it if you want.

MZ-Tools 8.0 Build released

Yesterday it was the first anniversary of MZ-Tools 8.0 for VBA, VB6 and VB5. Happy birthday! I want to thank all the people whose feedback has made this product much better, requesting new features and enhancements, and reporting bugs.

Yesterday also a new build was released, as every month. The complete changelog is the following:

MZ-Tools released (October 1, 2016)

  • New [Internal] (VBA): MZ-Tools 8.0 for VBA Portable edition.
  • Fixed [#11589] (All): The Code Library doesn’t set the focus on the treeview with code templates when shown.
  • Fixed [#11522, #11524] (VB6/VB5): Toolwindows could not be shown (System.InvalidCastException “Unable to cast COM object of type ‘System.__ComObject’ to class type System.Windows.Forms.UserControl”) on Windows 8 or higher if VB6/VB5 is running in compatibility mode with Windows XP. This bug was introduced in build
  • Fixed [#11580] (All): The Headers Review didn’t ignore spaces at the end of a line for VB/VB.NET languages.
  • Fixed [#11589] (VB/VBA): The Esc key allows to close toolwindows.
  • Fixed [#11570] (VB/VBA): The Line Indenting feature caused “System.InvalidOperationException: Indentation of paragraph of file failed” if the file ended with a line with spaces and the last method included line numbers.
  • Fixed [#11544] (VBA): The Options window doesn’t show the Personal / Team options tabs on some configurations (Windows 10 on Parallels).
  • Fixed [#11554] (VBA): The Generate HTML/XML documentation feature crashed the VBA editor of the GE iFix host.
  • Fixed [#11589] (VBA): The Tab key didn’t navigate correctly in the Code Library.
  • Fixed [Internal] (All): The dialog to download an updated version didn’t set correctly the position of a label.
  • Fixed [Internal] (VBA): MZ-Tools could not be loaded in the VBA editor of Office 2000 on Windows XP with .NET Framework 2.0.