![]() |
What does Compile VBAProject do
Hello,
I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject. What does this do? Kind Regards, Charlie.B |
What does Compile VBAProject do
Compiling converts the code written in the VBE into code that can be read by Windows. If you don't do it then it is automatically done when the code is run. If the code won't compile then it won't run. -- Jim Cone Portland, Oregon USA ( http://tinyurl.com/PrimitiveSoftware ) "CB" wrote in message ... Hello, I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject. What does this do? Kind Regards, Charlie.B |
What does Compile VBAProject do
In the grander scheme of things not much from an execution stand point. Where
it is useful is that it checks your code to confirm that there are no syntax errors. Code that has systax errors will execute up to the procedure with the error and then it will crash. To that end it is worth compiling. Here is an explanation of compiling in VBA... http://orlando.mvps.org/VBADecompile...IdC=OrlMoreWin -- HTH... Jim Thomlinson "CB" wrote: Hello, I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject. What does this do? Kind Regards, Charlie.B . |
What does Compile VBAProject do
That is the most coprehensive explanation that I have seen on how VBA works.
Thanks Jim. "Jim Thomlinson" wrote in message ... In the grander scheme of things not much from an execution stand point. Where it is useful is that it checks your code to confirm that there are no syntax errors. Code that has systax errors will execute up to the procedure with the error and then it will crash. To that end it is worth compiling. Here is an explanation of compiling in VBA... http://orlando.mvps.org/VBADecompile...IdC=OrlMoreWin -- HTH... Jim Thomlinson "CB" wrote: Hello, I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject. What does this do? Kind Regards, Charlie.B . |
What does Compile VBAProject do
I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject.
What does this do? VBA code is never stored as the plain text that you type in to the editor. Input is immediately converted to platform- and version-independent byte codes called OpCodes. These OpCodes are converted by the editor to the text you see on the screen. When you compile the project, the compiler translates these OpCodes to platform- and version-specific codes called ExCodes. When you run the code, the runtime reads the ExCodes and executes actual machine code on behalf of the project based on the ExCodes. This whole process is similar in principle to how Java and the Java Virtual Machine work. If you were to export all your VBA code to text files and then remove all the modules and then re-import the code from the text files back into VBA (which is exactly what Rob Bovey's Code Cleaner does), you'll see a decrease in file size. This is because the ExCodes were purged and have not yet been recreated. Then, if you compile the project, the file size will increase because now it stores the ExCodes in addition to the OpCodes. You really never need to compile the code. VBA will automatically do it when necessary. However, the Compile command also does syntax checking, which is its only real practical purpose. Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 19 May 2010 21:56:49 +1000, CB wrote: Hello, I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject. What does this do? Kind Regards, Charlie.B |
All times are GMT +1. The time now is 06:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com