PC Review


Reply
Thread Tools Rate Thread

What does Compile VBAProject do

 
 
CB
Guest
Posts: n/a
 
      19th May 2010
Hello,
I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject.
What does this do?
Kind Regards,
Charlie.B
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      19th May 2010

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" <(E-Mail Removed)>
wrote in message news:4bf3d201$0$6278$(E-Mail Removed)...
Hello,
I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject.
What does this do?
Kind Regards,
Charlie.B
 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      19th May 2010
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
> .
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      19th May 2010
That is the most coprehensive explanation that I have seen on how VBA works.
Thanks Jim.


"Jim Thomlinson" <James_Thomlinson@owfg-Re-Move-This-.com> wrote in message
newsB5BC422-B8AE-4E28-9BFE-(E-Mail Removed)...
> 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
>> .
>>



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      19th May 2010
>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 <(E-Mail Removed)> wrote:

>Hello,
>I notice in Excel VBA under the Menu "Debug" you see Compile VBAProject.
>What does this do?
>Kind Regards,
>Charlie.B

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 SP1 - Bug in Debug->Compile VBAProject Ron West Microsoft Excel Crashes 0 2nd Jan 2009 11:14 AM
VBAProject name compile error, not defined at compile time Matthew Dodds Microsoft Excel Programming 1 13th Dec 2005 07:17 PM
Debug/Compile VBAProject not available =?Utf-8?B?bWlsbHk=?= Microsoft Excel Programming 3 21st Jul 2005 08:58 AM
can i fine tune VS.Net compile/ use parallel process when compile? norton Microsoft Dot NET 0 1st May 2004 07:09 PM
How to get rid of a VBAProject? GF Microsoft Excel Programming 1 20th Feb 2004 03:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:55 PM.