Thursday, May 01, 2014

Word DOC File (Old Format) Template VBA Code Cleaner

This article describes how in the Word 97-2002 (and maybe 2003) repeated changes to template file will eventually corrupt the VBA. There is a downloadable tool here which allows you to backup your VBA, remove the VBA from the template, save the template and re-import the VBA for a smaller and now healthier template file.
"Word templates get bloated through repeated editing and saving of the VBA code. Bloated templates can often throw invalid page faults for no apparent reason when running VBA code.
Why Word doesn't clean up after itself when saving a template which contains a VBA project is one of the great mysteries of life. Excel suffers from the same problem.
The way to fix this is to export and remove all the modules from the template, and then save the template. (Take a backup first!) Then re-import all the modules again, save the template, recompile and save the template again. If you have been editing the VBA over a long period, and saving many times, you may be astonished at how much smaller the new template is.
How often should you clean a project? No one can answer that question for you. Each project is different. Larger projects generally need to be cleaned more often than smaller projects. One rule of thumb is to clean a project whenever it has grown to 1.5 times its normal size but this is a rough guideline only. Very large projects should be cleaned well before they reach this size.
The Word Code Cleaner cannot remove bloat caused by extensive customizations of Command Bars or Key Bindings. If a project contains substantial customization of this sort, or if you frequently modify the customization and save the changes, the project will eventually become corrupt, even if you do regularly clean it with the Word Code Cleaner..."

No comments:

Hasleo Data Recovery FreeV3.2 - Free as in Freeware - Permanently from Hasleo Software "Hasleo Data Recovery FreeV3.2 100% Free Data Recovery Software...