Access JumpStart 2.0 | Blog

A Rapid Development Framework for Microsoft Access

I’ve probably clicked on this button before, but I must say, I have absolutely no idea off the top of my head what this does:

I noticed it today in the VBE editor. “Clean Project”. No 3 dots. I’m going to try to click it and see what happens!

Ok, I clicked it. It closed all my VBE windows and popped up a dialog asking me if I want to save all my VBA modules:

Since I of course have a backup and can restore from my SVN repository if I want, i’ll go ahead and save it. A prompt appeared for each module and asked me for a name to save it as. I just used the same names and clicked OK 6 times. And now it appears to be done. No information pops up or anything, however, when I look in the folder the file is in, I see a new backup file called:

Aha! Here is a new backup file with the name MZToolsCleanBackup extension. Ok, so I still don’t know what it did, but at least now I know it was a procedure added by MZ-Tools. Here is a link to download a free trial:

Download MZ-Tools 8.0 (mztools.com)

I thought this might have been a feature built into Access, as it was not in the MZ-Tools menu. It was on the File menu of the VBA IDE. So I will now check out the MZ-Tools documentation to see what they say it is.

Hmm.. It’s not mentioned in the Features list on the web site and it’s not listed in the Index of the Documentation under “Clean Project”. I’m continuing the hunt. Aha, by using the Search function in the Documentation, it brings up 2 results for “Clean Project”. First one is the main entry which is it’s own page. Not much in terms of navigation within that page except for Next and Previous and Top links. It does have a tag of VBA though, so I think it’s a VBA only feature. Here is the page in the online documentation:


The Clean Project feature allows you to solve some strange problems that can happen in VBA projects because of junk created internally by the VBA compiler. To solve these problems the classes, modules and userforms must be exported as text files, removed from the project and imported back to the project. This feature automates this process.

MZ-Tools offers the following ways to clean the selected VBA project:

  • The File | Clean Project menu.
  • The Clean context menu in the Project Explorer.
  • The keyboard shortcut associated with the Clean Project feature.

Remarks:

  • Do not clean a VBA project while a UserForm is running.
  • A backup file with the extension “.MZToolsCleanBackup” is created in the same folder of the Office document (for example, “Book1.xlsm.MZToolsCleanBackup”) before starting the cleaning process.
  • The files are exported to a folder named “MZToolsClean” inside the temporary folder (typically “C:\Users\<user>\AppData\Local\Temp”). If the process is successful, that folder and its files are deleted.

So there it is. If you have strange problems with your VBA projects, you can try this procedure provided by MZ-tools which exports your modules and userforms to text files, deletes them, then imports them back in.