Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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
.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Name of VBAProject ??? Charlotte E. Excel Programming 1 September 10th 08 09:32 AM
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
Debug/Compile VBAProject not available milly Excel Programming 3 July 21st 05 08:58 AM
VBAProject Daniel[_4_] Excel Programming 5 July 4th 05 12:01 PM
How to get rid of a VBAProject? GF[_2_] Excel Programming 1 February 20th 04 03:10 PM


All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"