Compiling VBA modules/procedures? Why? When?

jkoetter

New Member
Joined
Mar 21, 2006
Messages
7
I would appreciate someone pointing me to somewhere where I can read up on compiling VBA code. I see "Compile" as an option on one of the drop down boxes when I am writing my code but have choosen not to use it until I fully understand WHAT I am doing, WHY I am doing it, and WHEN I should or should not do it? Any suggestion on where to look for this informaion?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
What drop down box? AFAIK, "Compile {project name}" is a menu item (part of the Debug menu).

VB(A) is a language that is "compiled" into an intermediate form. That intermediate form is then interpreted at runtime.

Use it to your heart's content. It will do you no harm.

I use it regularly to syntax check my code.

If you don't explicitly compile the code, it will be compiled on-demand at run-time. Much better you do the needful in advance and ensure it is syntactically error-free.

There are some subtle issues involved with when one should compile the code and on what platform. But, I wouldn't worry about those advanced issues at this point.
 
Upvote 0
Perhaps the OP is speaking of the "MakeCompiledFile Method"? The dropdown boxes known as intellisense? I'm fairly certain that this method is a lame duck unless you have the developer edition though the help files do not seem to indicate this or much at all for that matter...
 
Upvote 0
Thanks for the information. Sounds like I can not concern myself with compiling code at this time. I appreciate the help!
 
Upvote 0
why compile VBA

Because it'll catch some syntax errors and other missing items. It doesn't "compile" like a C compiler would create a .exe but it is useful. Of course if you don't use Option Explicit at the top of all your modules, you're also setting yourself up for many hard to find errors.

Deb
 
Upvote 0

Forum statistics

Threads
1,225,438
Messages
6,184,986
Members
453,272
Latest member
isabelarodriigs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top