If you're thinking of achieving the same as through the Access /decompile switch, I'd say the easiest is probably to export and remove the modules and userforms, then import them again.
When I use VBA with MS Access, I can decompile and recompile the code by adding a /decompile command switch to the command line in a shortcut (or I guess you could do it in the Start/Run window as well). This has the effect of cleaning up the code, and often reduces the file size considerably.
My document size has increased a lot since I've added a bunch of code, and I notice that previously deleted or renamed ActiveX controls still appear in the object box in the upper left of the VBA Editor, even though they have ceased to exist on the form. They don't show up in the Properties drop-down window, so I'm not suspecting they are lurking somewhere, hidden.
Programmatic access to Visual Basic Project is not trusted.
I am following the instrutions I'm finding to move the code to a clean document, and will keep my ear open to other suggestions. If I succeed, I'll post the results.
Curious. I got the Code Cleaner to run by checking the appropriate box (allow access to VBA project) in the Security window. However, I don't see an effect after the recompile/save. The file size is identical and the phantom control references are still there.
In a copy of the doc I deleted all the code from the module I use (ThisDocument) and found that the file size is still over 700 KB. It is over 900 KB with the code there. I'm hesitant to go on testing the export/import instructions because
a) the instructions refer to operations on a template. This is not a .dot, just a .doc
b) the instructions refer to other modules. My code is all in ThisDocument
c) Code Cleaner did leave the project uncompiled, so it must have done something. Perhaps there is nothing else I can do.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.