MZ-Tools released

The update of this month is quite small but it brings an important improvement for some VB/VBA users: you can now use the Sort Code Elements feature even if the General-Declarations section contains conditional compilation. The complete changelog is the following:

  • Enhanced [#14870] (VB/VBA): MZ-Tools now locates buttons on toolbars and menus by Id instead of by FaceId to allow picture customization.
  • Enhanced [#14898] (VB/VBA): The Sort Code Elements feature now allows conditional compilation inside the General-Declarations section.
  • Fixed [#14867] (VBA): NullReferenceException could happen when getting the code elements of a file.
  • Fixed [#14876] (All): The Method Callers feature was unable to resolve the type of the expression ‘With New … End With’.

New build released

I hope everyone reading this is OK and healthy. Here at Spain we have entered the 4th week locked-down at home, and the forecast is to remain so another four weeks at least. Things don’t necessarily stop due to that situation, so past April 1 I released a new build of MZ-Tools 8.0 (build fixing small bugs and annoyances that some of you have reported me in the past weeks.

The list is below. Take care.

  • Fixed [#14715] (VB/VBA): Single-line declaration of methods in results window generated from multi-line declaration could contain extra spaces.
  • Fixed [#14753] (VB/VBA): The expansion keyword feature for code templates didn’t indent correctly the code in some cases.
  • Fixed [#14604] (VB/VBA): The Generate HTML Documentation could cause problems with “\Doc” folder.
  • Fixed [#14818] (VB): NullReferenceException could happen during line indenting review.
  • Fixed [#14575] (VS): The Dead Code Review could cause error “Couldn’t get SDK folder” in some Visual Studio versions.
  • Fixed [#14816] (VBA): The MZTools8VBAPortable.exe.config file contained the “safemode” value which is not required.
  • Fixed [Internal] (VBA): The version for Office 2016 or higher is now shown as “2016/2019/365” since all of them are version number 16.0.
  • Fixed [Internal] (VS): Toolwindows didn’t change colors when changing the theme from light to dark or viceversa.

New build released

A new build of MZ-Tools was released on Feb 1. Since on Jan 1 there was no new build, this one has quite a few small fixes and a couple of enhancements. Also, the help files have been updated to better explain installation issues and advanced scenarios.

The complete changelog is the following:

  • Enhanced [Internal] (All): Buttons on toolbars of toolwindows can be reached now with the Left/Right keys.
  • Enhanced [Internal] (All): The Check for Updates feature now downloads the new setup to the desktop folder instead of the temp folder when using the Download and Install button.
  • Fixed [#14577] (All): In the Find Text dialog (English) access keys were duplicated.
  • Fixed [#14577] (All): In toolwindows, holding the Alt key to show access keys moved the focus to the main menu.
  • Fixed [#14587] (VS): The help file did not document correctly the prefixes for MZ-Tools commands (“MZTools” for Visual Studio 2015 and higher and “MZTools8” for Visual Studio 2013 and lower).
  • Fixed [#14589] (VB/VBA): The Method Callers feature didn’t parse correctly declarations ending with comments causing long delays in some cases.
  • Fixed [#14548] (VB/VBA): The Dead Code Review didn’t recognize as unused a method variable or field whose name was the same than its type.
  • Fixed [#Internal] (All): Pressing the Esc key to close a modal dialog launched by a toolwindow closed the toolwindow too.
  • Fixed [#Internal] (All): If a modal dialog was shown from a toolwindow, after closing it the focus didn’t return to the toolwindow.
  • Fixed [#Internal] (VBA): The portable edition didn’t enforce the required .NET Framework 3.5 on Windows XP / Windows Server 2003, only enforced .NET Framework 2.0.

New build released

A new build of MZ-Tools 8 has been released,, with some bug fixes and more importantly with improvements when sorting listviews.

All lists now use the previous sorting column as secondary sorting column when two values of the primary sorting column are the same. For example, in the Code Explorer feature of VB/VBA, if you want to order by Kind and then by Name, you would click the Name column and then the Kind column: if two code elements have the same Kind (say, “Sub”), then they are sorted using the Name as secondary criteria.

Also, for listviews that make sense (Code Explorer, Task List, Favorite Code Elements), their sorting criteria is now remembered between sessions.

Finally, the Code Explorer now allows to sort in ascending / descending order like previously, but also to sort as code elements appear in code. So, its columns go through three states.

The complete list of changes is the following:

  • Enhanced [#14399] (VB/VBA): The Code Explorer now allows 3-state sorting: ascending / descending / as in code.
  • Enhanced [#14399] (All): Listviews now use the previous sorting column as secondary sorting column.
  • Enhanced [#14399] (All): The Favorite Code Elements toolwindow now remembers the sorting column between sessions.
  • Enhanced [#14399] (VB/VBA): The Code Explorer and Task List toolwindows now remember the sorting column between sessions.
  • Fixed [#14393] (VBA): The Check for Updates feature didn’t use the original command-line options when restarting Office applications.
  • Fixed [#14436] (VBA): In Office 2000/2002 after locating a result if the code editor was previously closed the comboboxes at the top of the VBA code editor were not repainted or an System.AccessViolationException was thrown.
  • Fixed [#14428] (VS): Error getting SDK folder in Visual Studio 2019 when only .NET Framework 4.8 is installed.
  • Fixed [Internal] (VS): The Control Names Assistant showed white background in textboxes when using the dark theme.
  • Fixed [Internal] (VS): The Control Names Assistant didn’t change names of controls.

New build released

A new build ( of MZ-Tools has been released, that includes some enhancements to remember between sessions your last settings for operations, clickable columns for the Code Explorer (VB/VBA) and support for priority in code tasks, using “[+]” or “[-]” in the line that contains the TODO code task:

Also, the screenshots of the documentation have been updated and unified (using the ones for the VBA IDE) and several bugs have been fixed.

The complete list of changes is the following:

MZ-Tools released (May 1, 2019)

  • Enhanced [#14013] (All): In the options dialog for the Insert Headers feature, the selected code elements to insert headers to are now remembered, even between sessions.
  • Enhanced [#14013] (All): In the options dialog for the Review Quality feature, the selected reviews to execute are now remembered between sessions.
  • Enhanced [#14013] (All): In the options dialog for an operation, the selected scope is now remembered between sessions.
  • Enhanced [#13939] (All): The Control Assistants are now available in the VBA editor of Access if the user has added the Insert > UserForm menu entry.
  • Enhanced [#13977] (All): The last used scope is now preselected in the operation scope dialog.
  • Enhanced [#13972] (VB/VBA): The columns of the Code Explorer are now clickable to allow sorting.
  • Enhanced [Internal] (VB/VBA): Code tasks now support priority using “[+]” or “[-]” in the line of code containing the “TODO” token.
  • Fixed [#13995] (VBA): The TabIndex Assistant could show error “The algorithm that calculates the correct Tab Index has returned a number of controls different to the number of controls in the Tab Index Assistant list” when moving up/down a deleted control.
  • Fixed [Internal] (All): NullReferenceException could happen in the Generate HTML/XML Documentation features.
  • Fixed [Internal] (VS): Removed checkbox in setup to use COM Shim or not for Visual Studio (not required).

New build released

Yesterday a new build ( was released. While it only introduces a minor enhancement to sort the code tasks of the Task List, it fixes two important bugs that have caused problems to a number of German and Asian users during the past years. Finally MZ-Tools 8.0 can coexist with SmartTools AccessToExcel 4.0 für Access (and similar popular German add-ins for Access) and can handle correctly text that uses double-byte encodings (Asian languages, for example). Hopefully those two errors are fixed for good. There are also minor fixes to provide an even better user experience:

MZ-Tools released (February 1, 2019)

  • Enhanced [#13731] (VB/VBA): The Code Tasks of the Task List can be sorted now by column.
  • Fixed [#13690] (All): The Convert Field to Property feature removed the comment of a field.
  • Fixed [#11754] (VBA): A System.Runtime.InteropServices.SEHException (0x80004005) happened at startup when using SmartTools AccessToExcel 4.0 für Access.
  • Fixed [#13702] (VB/VBA): Several features didn’t work correctly with double-byte encodings such as Chinese, etc.
  • Fixed [#13653] (VB/VBA): An sporadic COMException that can happen during startup to restore toolwindows of the last session is now ignored.
  • Fixed [#13529] (VB/VBA): The add-in was initialized twice causing errors in some cases.
  • Fixed [#13716] (VB6): The clipboard text was not preserved when loading MZ-Tools.
  • Fixed [#13775] (VS): Some features could cause NullReferenceException with .cpp files.
  • Fixed [#13788] (VBA): The TabIndex Assistant, Control Names Assistant and Control Explorer showed the message “There is no active document window” instead of “The active window is not a window with a designer (Form, UserControl, etc.)”.

Happy New Year! And a new build (

Happy New Year to all! I have been working the last couple of months fixing the bugs that some of you have reported, and also adding support for Visual Studio 2019 and for the R language (Find feature, code templates, etc. just in case you work with statistics). There is also an enhancement to avoid making an executable before a quality review in VB6, better support for the OLEDB Provider for ODBC and some memory for the Code Explorer. The complete list of changes is the following:

  • Enhanced (VS): Added support for Visual Studio 2019.
  • Enhanced (VS): Added support for the R language.
  • Enhanced [#13629] (VB6): The Review Quality feature no longer requires to build the project.
  • Enhanced [#13599] (All): New predefined variable “Year” ($P[YEAR]) (useful for copyrights).
  • Enhanced [#13614] (All): The Database Connection String Assistant now includes the Microsoft OLE DB Provider for ODBC Drivers.
  • Enhanced [#13476] (VB/VBA): The Code Explorer now remembers filters on the toolbar across sessions.
  • Fixed [#13486] (VS): System.NullReferenceException could happen using the Method Callers feature.
  • Fixed [#12937, #12330, #12644, #13517] (VS): System.EntryPointNotFoundException could happen using the Statistics feature.
  • Fixed [#13529] (All): The sporadic COMException that can happen showing a toolwindow is now reported as a friendly error rather than as a bug.
  • Fixed [#13572] (All): The “I” access key (used by the “Insert” button) was duplicated in other controls of the New Method Assistant dialog.
  • Fixed [#12852] (VS): NullReferenceException happened with expression-bodied properties that had an attribute.
  • Fixed [#13586] (VS): NullReferenceException happened with expression-bodied properties that used a separate line for the => operator.
  • Fixed [#13595] (VB/VBA): The Find Text feature showed results at the first line of the code window not showing previous lines of code.
  • Fixed [Internal] (All): NullReferenceException happened if the IDE was closed just after showing a toolwindow from the previous session.
  • Fixed [13684] (VB/VBA): The Database Connection String Assistant showed as exception to report the error “System.ArgumentException: Provider is not registered.
  • Fixed [13683] (VS): The Convert Field to Property feature didn’t work correctly with C# fields that lack an explicit access in the declaration.

New build released

Yesterday I released a new build ( of MZ-Tools 8.0. If you keep track of build numbers you will notice that the last one (August 1) was, so why this big increment? The reason is that these months I am migrating the system to produce builds to the Azure DevOps (formerly Visual Studio Team Services) build/release pipelines, and I have implemented a new auto-increment logic for build numbers. Although this migration is causing that (temporarily) I don’t release a new build each month as in the past, when finished it will allow me to send a pre-production build with a fix to the customer reporting a bug as soon as I check-in the fix in source code, all in a 100% automated fashion.

This new build introduces some enhancements, such as async package for Visual Studio 2015/2017 (Microsoft will require async packages in future versions) and a new browser-based local help instead of the old HTML Help (.chm) technology that was created for Windows 98 and hasn’t been updated by Microsoft since then. Also, it fixes quite a few bugs:

MZ-Tools released (November 1, 2018)

  • Enhanced (All): The local help has changed from HTML Help format (.chm) to browser-based web help.
  • Enhanced [#13427] (VB/VBA): The External Utilities feature now supports the Selected Text predefined variable, useful to pass a selected URL in code to a browser.
  • Enhanced (VB/VBA): Added checkbox in setup to use COM Shim or not.
  • Fixed [#13261] (All): If an exception happens loading a xml document, a friendly error message is now shown.
  • Fixed [#13330] (All): When using the Replace Whole Line(s) With New Line(s) option of the Replace feature, an entire final line was removed if the searched text included \r\n.
  • Fixed [#13330] (All): When using the Replace Whole Line(s) With New Line(s) option of the Replace feature, NullReferenceException happened if the Compose New Line button was not clicked.
  • Fixed [#13342] (All): Operations that modify code silenced some exceptions.
  • Fixed [#13288] (VB/VBA): The Task List didn’t show System.IO.IOException as friendly messages.
  • Fixed [#13286] (VB/VBA): The keyboard shortcuts editor didn’t show used shortcuts in German.
  • Fixed [#13388] (VB/VBA): The dead code review didn’t detect as unused variables with the same name than recordset fields using bang syntax.
  • Fixed [#13287] (VB/VBA): The line indenter didn’t parse correctly type fields that used end block keywords as the name of the field.
  • Fixed [#13425] (VB/VBA): Error parsing block with colon and line continuation before end statement of the block.
  • Fixed [#13403] (VBA): The default options for Control Explorer didn’t include MSForms controls.
  • Fixed [#13438] (VB.NET): The feature Convert Field to Property didn’t work correctly with VB.NET generic types.

New build MZ-Tools

It has been a while since the last update, I know. After build (March 1) a new build was released on April 1 that contained a change in the implementation of keyboard shortcuts for features, code templates and error handlers of VB/VBA. The Microsoft API for VB/VBA add-ins doesn’t provide support for keyboard shortcuts, so each add-in has to use some trick to provide them. For years MZ-Tools has used global hotkeys of Windows, but they have some issues (because hotkeys are global, the add-in must unregister them when the IDE is not active and re-register them when the IDE becomes active again). In build a new more robust approach was used but it didn’t work as expected and crashes and duplicated insertions of code templates/error handlers were reported in the first day so that build was retired. Yesterday, after some months without updates, a new build has been released with the bugs reported since April.

This new build introduces also an important and somewhat breaking change if you are still using Visual Studio 2012 or 2013: MZ-Tools 8.0 for Visual Studio was provided in two ways:

  • As an “add-in” (Tools > Add-In Manager) for Visual Studio 2005, 2008 and 2010
  • As a “package” (Tools > Extensions and Updates) for Visual Studio 2012, 2013, 2015 and 2017

The functionality is roughly the same in both cases (only the installation and the Check for Updates mechanism is different).

Due to some upcoming changes in Visual Studio 2017, it’s increasingly difficult to provide the same package for Visual Studio 2012, 2013, 2015 and 2017. New Visual Studio APIs only support Visual Studio 2015 and 2017, so rather than providing a new different download for those two versions (there are already 5 download buttons on the Download page!), the add-in in build supports not only Visual Studio 2005, 2008 and 2010 but also Visual Studio 2012 and 2013, and the package no longer support them.

This means that if you are using MZ-Tools for Visual Studio 2012 / 2013 you must:

  • Make a backup of your personal / team options, just in case, although the same location (C:\Users\<user>\AppData\Roaming\MZTools Software\MZTools8\VS) is used for the add-in and for the package.
  • Go to Tools > Extensions and Updates, Installed section, locate MZ-Tools and click the Uninstall button to uninstall the package.
  • Download the add-in setup for MZ-Tools 8.0 for Visual Studio 2005-2013 and install it.

The complete changelog is the following:

MZ-Tools released (August 1, 2018)

  • Changed (VS 2012, 2013): MZ-Tools is now provided as an add-in for VS 2012 and 2013 rather than as a package.
  • Enhanced [#13217] (All): Added support for headers in enum items.
  • Enhanced [#13154] (VB/VBA): Added menu entries for line numbering and indenting to the context menu of the code window.
  • Enhanced [#13168] (All): MZ-Tools ensures now that toolwindows are completely inside some screen when shown.
  • Enhanced [#13144] (All): The Favorite Code Elements toolwindow no longer shows a modal messagebox when a code element is not found. Now it shows the message in a column.
  • Fixed [#12956, #12957] (VB/VBA): The mechanism for keyboard shortcuts introduced in build didn’t work well and has been reverted.
  • Fixed [#11324, #12941] (VB/VBA): The initial indentation of MsgBox statements generared by the MsgBox Assistant was always fixed.
  • Fixed [#12964] (All): Typo in German language in the Task List.
  • Fixed [#12914] (All): MZ-Tools could hang when trying to show an exception dialog if some project reference was invalid or missing.
  • Fixed [#13202] (All): NullReferenceException could happen unloading MZ-Tools.
  • Fixed [#12914] (VB/VBA): The Method Callers feature could take a long time if a referenced type name didn’t have the correct upper/lower case.
  • Fixed [#13066] (VB/VBA): The indenter removed labels that are only numbers.
  • Fixed [#13040] (All): The Switch Assignment feature didn’t work correctly with the comment character inside quotes.
  • Fixed [#12874] (VS): The Find Text feature didn’t locate results if the end point of a result using regular expressions was between the \r and \n characters.
  • Fixed [#12873] (VB/VBA): The type of a member of a UDT was not parsed correctly if it contained a comment or the “New” keyword.
  • Fixed [#12918] (VB/VBA): Declare Sub and Declare Function were not parsed correctly if they contain comment or blank lines before the declaration.
  • Fixed [#12890] (VBA): Updating MZ-Tools from the VBA editor of Outlook caused error “Cannot start Microsoft Outlook. The command line argument is not valid. Verify the switch you are using.”
  • Fixed [#12922] (VBA): MZ-Tools crashed when closing Microsoft Project.
  • Fixed [#13105] (VS): Operations made active inactive .xaml windows.
  • Fixed [Internal] (VB/VBA): The icon of methods (Sub/Function) was not retrieved correctly in the Favorite Code Elements toolwindow.
  • Fixed [Internal] (VS): Declarations of attributes using the characters “{}” were not parsed correctly.
  • Fixed [Internal] (VS 2012/2013/2015/2017): The Insert Headers buttons has been moved to the left of the Insert Header button.
  • Fixed [Internal] (VB/VBA): The Insert Headers operation didn’t insert headers for child members in some cases.
  • Fixed [Internal] (VS): The scope selector did not show the down arrow in the button of ‘Files matching regular expression’ scope.

About the unresponsive floating toolwindows of MZ-Tools for VBA with some Office 2016 applications

A couple of months ago, in early April, the first reports of “unresponsive”, “blank” toolwindows of MZ-Tools 8.0 for VBA started to arrive. The toolwindows appeared without content and clicking the Close button did nothing. Something like this:

MZ-Tools uses toolwindows for many features such as Method Callers, Review Quality, etc. and the Find Text feature and all of them were affected.

At first I didn’t pay much attention because some users were not able to reproduce the problem, or solved it reinstalling or updating Office. Also, MZ-Tools has tons of users and if the problem was general I would have received tons of bug reports, not two or three.

But some more reports arrived in May and then I decided to investigate. A common pattern emerged:

  • The problem happened always with Office 2016, not with older versions.
  • The problem happened with Word 2016 and PowerPoint 2016 but never with Access 2016 or Excel 2016 (except one case using the Insiders version of Excel, not the regular one). That explained why I didn’t receive tons of bug reports: Excel and Access are the most used Office applications with MZ-Tools and were not affected.
  • Users found a workaround: to dock the toolwindow to some other window (so it was no longer floating), which showed the content inside, and to make it floating again. The problem would happen again in the next session, though.

At first I was not able to reproduce the problem because I was using Excel or Access but as soon as I tested with Word I was. I knew that the problem hadn’t happened until April, otherwise somebody using Word or PowerPoint would have reported it in the last couple of years.

Also I tested with old versions of MZ-Tools 8.0 for VBA (even the first betas of 2015) and the problem was reproduced, so it was not some bug introduced by a recent build of MZ-Tools 8.0.

Yesterday I tested with other third party .NET-based add-ins for the VBA editor and the problem was reproduced. And I tested with the old MZ-Tools 3.0 for VBA (which doesn’t use .NET usercontrols inside toolwindows but ActiveX userdocuments created with VB6) and the problem was reproduced. So it was not a .NET-related problem. It was Office. And to my surprise, I was able to reproduce the problem with no add-in at all, just using the built-in Project Explorer of the VBA editor in floating state rather than in the usual docked state:

  1. Update to some recent version of Office 2016 (1804 or 1805)
  2. Drag the Project Explorer to floating state
  3. Close it
  4. Close the VBA editor and Word 2016
  5. Start again Word 2016 and the VBA editor
  6. Click the button on the toolbar to show the Project Explorer

The Project Explorer toolwindow should appear floating but blank.

Note: you many need to try the whole procedure a couple of times if you have just upgraded or downgraded the version of Office.

Today I have downgraded Office 2016 to previous versions to find which one introduced the problem with the procedure explained at How to revert to an earlier version of Office 2013 or Office 2016 Click-to-Run. And it seems that the problem was introduced by:

Version 1803 (Build 9126.2116) (March 27)

The previous version:

Version 1802 (Build 9029.2253) (March 13)

seems to work fine (although when testing you need to try a couple of times after downgrading or upgrading, maybe because click-to-run upgrades in the background). The date (March 27) of the version 1803 which introduced the problem is consistent with the first bug reports appearing in early April.

I will report this problem to Microsoft. Until a fix arrives, if you are affected by this problem the best approach is to disable Office 2016 upgrades and to revert back to version 1802 (Build 9029.2253).

Update (August 1, 2018): the problem seems to be solved in Version 1807 (Build 10325.20082) (July 25)