Does VBA keep a cache of past code changes?
I created a smallish application in VBA for autocad (.dvb file). It has a form and a bunch of modules.
I originally wrote some code in a module that contained and IP address (10.0.0.16). Later on I replaced the IP address with the actual netbios name (MyServer).
In doing some maintenance I had searched the folder containing this file with FileLocater Pro for the text string "10.0.0". Lo and behold it got a hit on that file. I've searched the file and the string "10.0.0" does not exist anywhe开发者_StackOverflowre.
What gives? My only guess is that the .dvb file has a history log or undo log of past changes maybe. Does anyone know?
AFAIK it does not. However the search feature on most windows systems indexes your files and then when you do a search, it searches the index. It's possible this is how your false positive was generated. However if you really want to be sure you can always just open (a copy of) the file in notepad and do a ctrl-f.
It may not save a cache, but I've seen that Office saves VBA projects in a structured storage container. If Autocad does the same, when an item is deleted &c. pages in the container file may be marked unused instead of being actually deleted. This helps performance when you make lots of edits to large files. That may not sound very relevant to a VBA project, but structured storage was designed to handle more general cases where this may become an issue.
My observation about DVB files is, that they increase over time with an amount that seems to be in no relation to the amount of changes made. Simply adding a new line somewhere might result in increasing the file size of the DVB from 2MB to 4MB! So it seems, that the DVB might really contain some old elements which are not garbage collected or something like that.
To decrease the file size, one can use AutoCAD to save the DVB with a different name. The new file then has only the actual information and is cleaned up. Replace the old DVB with the new one and everything should work. Large files also seem to slow down the VBA IDE!
精彩评论