• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

How VBA code can tell if it's not compiled, and how it can compile itself

Is there a way you can tell if all of the VBA modules of a project are compiled or not (using a VBA procedure, that is)?
Can you run a VBA procedure to compile all modules of a VBA project (or at least all of the modules other than the one the procedure is in)?

EE expert Jim Dettman says there is an undocumented SYSCMD function (SysCmd(504, 16483) ) available in MS Access that will compile all modules, but advises not to use it. (Ref: http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26639269.html#a34231494 ID:34230641)
  • 3
2 Solutions
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:

If application.IsCompiled =  True Then

   ' Do what ever

End If

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
To compile all modules:

docmd.RunCommand acCmdCompileAllModules

Dale FyeCommented:
There is a RunCommand constant (two actually) that might work, but I have never tried either:

Docmd.RunCommand acCmdCompileAllModules


Docmd.RunCommand acCmdCompileAndSaveAllModules
You can check these out at Terry Wickenden's site: http://www.accessruncommand.com/index.htm
The second one actually contains a code example.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
btw ... I tested docmd.RunCommand acCmdCompileAllModules (was well as IsCompiled) and they do work.

MilewskpAuthor Commented:
Thanks mx!

Hi fyed,
I tried Terry's code. It appears to be unnecessarily complicated, since mx's one liners seems to work fine (for A2003 SP3 anyway).

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now