What does Compile VBA Project do anyway

Contributor

There is an option in my Excel 2016 VBA project that says Compile VBA Project. What does this do?

 

rodsan724_0-1635471712093.png

 

3 Replies

@rodsan724 

It does two things:

  1. It checks whether the code in the workbook is syntactically correct. If it finds an error, it will display an error message and highlight the problematic line. This is very useful, in particular before distributing a workbook to others.
  2. It stores the VBA code in a tokenized form that executes more efficiently than interpreting the text line by line. The VBE will also do this when you run a macro, but then for that macro only. Debug > Compile <projectname> will do it for all code in the workbook at once.
Does it create a new file or just stuff internally?

@rodsan724 

The tokenized code is stored in the workbook itself.