Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
Dear All,
Please, could anybody tell me some more details about the VBA Cleaner? The fact a program like VBA Cleaner exists doesn't make sense to me. The only explanation I get is the following: During the process of creating VBA programs a lot of junk code builds up in your files. If you don't clean your files periodically you will begin to experience strange problems caused by this extra baggage. Cleaning a project involves exporting the contents of all its VBComponents to text files, deleting the components and then importing the components back from the text files. How do I have to imagine this "junk code"? I'm very tidy writing my code. Regards, Bart |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
Bart,
The "junk" it removes is not visible to you. The code you write is not directly read by the computer. It is converted to a machine readable code during the compile operation. This is not a perfect process and the module can become bloated. The more changes you make to the code the larger the module can become. Many people use the "Cleaner" add-in and are happy with it. I have had some awful crashes using it and instead copy code to NotePad, delete the module, insert a new module and then copy the Notepad text back into the new module. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware wrote in message Dear All, Please, could anybody tell me some more details about the VBA Cleaner? The fact a program like VBA Cleaner exists doesn't make sense to me. The only explanation I get is the following: During the process of creating VBA programs a lot of junk code builds up in your files. If you don't clean your files periodically you will begin to experience strange problems caused by this extra baggage. Cleaning a project involves exporting the contents of all its VBComponents to text files, deleting the components and then importing the components back from the text files. How do I have to imagine this "junk code"? I'm very tidy writing my code. Regards, Bart |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
To add to Jim's answer:
The code you write in the VBE is the only part visible/accessible to you. However, there are a further 2 (or 3?) stages before the code actually gets executed. Depending on what you done and if the code has ever been compiled, your file may contain this code in various stages of compilation stored with it. Continual editing can leave bits of this intermediate code laying around in the file, which leads to bloat. Copying the text of the code out, either manually or with something like CodeCleaner, and pasting back into a new module, removes all the previous (partly) compiled code. Apart from keeping the file small and reliable, this can be useful in certain situations when you want/need to workaround compilation problems, as the code then has never been compiled. But that is another subject altogether. NickHK wrote in message oups.com... Dear All, Please, could anybody tell me some more details about the VBA Cleaner? The fact a program like VBA Cleaner exists doesn't make sense to me. The only explanation I get is the following: During the process of creating VBA programs a lot of junk code builds up in your files. If you don't clean your files periodically you will begin to experience strange problems caused by this extra baggage. Cleaning a project involves exporting the contents of all its VBComponents to text files, deleting the components and then importing the components back from the text files. How do I have to imagine this "junk code"? I'm very tidy writing my code. Regards, Bart |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
Here's an example : declare a series of module level variable - say
private mstrmyString1 as string .... private mstrmyString100 as string Now, this will make the human readable code larger - there are now 100 lines of code. Compile this code and you will see that the workbook gains in size as the compiled code is stored in the book. Now, delete the variables and recompile. You will not get the file back to the original size. Why? Because the compiled representation of the declared variables will not be removed. Hence the "bloat". I am not a fan of code cleaner but I do recommend stripping all code and worksheets to a new workbook before releasing to production - that's basically what code cleaner does but i prefer to do it manually. Hope that helps. -- http://www.alignment-systems.com " wrote: Dear All, Please, could anybody tell me some more details about the VBA Cleaner? The fact a program like VBA Cleaner exists doesn't make sense to me. The only explanation I get is the following: During the process of creating VBA programs a lot of junk code builds up in your files. If you don't clean your files periodically you will begin to experience strange problems caused by this extra baggage. Cleaning a project involves exporting the contents of all its VBComponents to text files, deleting the components and then importing the components back from the text files. How do I have to imagine this "junk code"? I'm very tidy writing my code. Regards, Bart |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
Many thanks for your replies. Makes it much more clear to me. Still
though it's a bit strange phenomenon to me: I have understanding for the phenomenon (my code isn't 100% bug-free neither), but then a third party piece of software (or yourself) has to take care of this... ? I just used VBA Cleaner for the first time after a month working full time on a project. For as far I know I hadn't any problems compiling. (It was just bad luck for me, because cleaning didn't solve my spooky problem with the ControlSources. But that's maybe another thread worth it..) I make sure to clean the files before delivery. Thanks again. Bart |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
my thanks to all of you for explaining this, also! i've always
wondered about this, especially since (when i'm done) my code is also tidy & neat..... i didn't realize there was behind-the-scenes stuff going on. but i think i'd feel more comfortable with the copying to notepad, delete module, insert new & recopy code. might also explain why some of my very complicated & hard to write (to me) codes run so slowly - finished code is not that long but there were LOTS of rewrites. :) susan On May 11, 5:32 am, wrote: Many thanks for your replies. Makes it much more clear to me. Still though it's a bit strange phenomenon to me: I have understanding for the phenomenon (my code isn't 100% bug-free neither), but then a third party piece of software (or yourself) has to take care of this... ? I just used VBA Cleaner for the first time after a month working full time on a project. For as far I know I hadn't any problems compiling. (It was just bad luck for me, because cleaning didn't solve my spooky problem with the ControlSources. But that's maybe another thread worth it..) I make sure to clean the files before delivery. Thanks again. Bart |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
i have a question, tho..........
if you don't use a commercial code cleaner, how do you clean userforms & worksheet codes???? well, worksheet codes i can see you could copy & paste everything into a new sheet, including the data. but userforms? :) susan On May 11, 8:57 am, Susan wrote: my thanks to all of you for explaining this, also! i've always wondered about this, especially since (when i'm done) my code is also tidy & neat..... i didn't realize there was behind-the-scenes stuff going on. but i think i'd feel more comfortable with the copying to notepad, delete module, insert new & recopy code. might also explain why some of my very complicated & hard to write (to me) codes run so slowly - finished code is not that long but there were LOTS of rewrites. :) susan On May 11, 5:32 am, wrote: Many thanks for your replies. Makes it much more clear to me. Still though it's a bit strange phenomenon to me: I have understanding for the phenomenon (my code isn't 100% bug-free neither), but then a third party piece of software (or yourself) has to take care of this... ? I just used VBA Cleaner for the first time after a month working full time on a project. For as far I know I hadn't any problems compiling. (It was just bad luck for me, because cleaning didn't solve my spooky problem with the ControlSources. But that's maybe another thread worth it..) I make sure to clean the files before delivery. Thanks again. Bart- Hide quoted text - - Show quoted text - |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is a VBA Cleaner and why using it?
What Code Cleaner does is Export the components (modules and userforms),
removes them, saves the file, then reimports the components. As far as I know, it ignores the code behind sheets and workbooks. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Susan" wrote in message oups.com... i have a question, tho.......... if you don't use a commercial code cleaner, how do you clean userforms & worksheet codes???? well, worksheet codes i can see you could copy & paste everything into a new sheet, including the data. but userforms? :) susan On May 11, 8:57 am, Susan wrote: my thanks to all of you for explaining this, also! i've always wondered about this, especially since (when i'm done) my code is also tidy & neat..... i didn't realize there was behind-the-scenes stuff going on. but i think i'd feel more comfortable with the copying to notepad, delete module, insert new & recopy code. might also explain why some of my very complicated & hard to write (to me) codes run so slowly - finished code is not that long but there were LOTS of rewrites. :) susan On May 11, 5:32 am, wrote: Many thanks for your replies. Makes it much more clear to me. Still though it's a bit strange phenomenon to me: I have understanding for the phenomenon (my code isn't 100% bug-free neither), but then a third party piece of software (or yourself) has to take care of this... ? I just used VBA Cleaner for the first time after a month working full time on a project. For as far I know I hadn't any problems compiling. (It was just bad luck for me, because cleaning didn't solve my spooky problem with the ControlSources. But that's maybe another thread worth it..) I make sure to clean the files before delivery. Thanks again. Bart- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code cleaner | Excel Discussion (Misc queries) | |||
code cleaner | Excel Programming | |||
Code Cleaner in 2003 | Excel Programming | |||
Code Cleaner | Excel Programming | |||
VB Code Cleaner | Excel Programming |