Hard question - How to change conditional compilation constants through code?

A

Andrew Webster

I use conditional compilation constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew
 
M

Marshall Barton

Andrew said:
I use conditional compilation constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.


Try investigating the Module editing methods Find,
ReplaceLine, InsertLines, etc. You should be able to put
together a module with Build and Develop procedures to
modify (or load from file) the Const declaration statements.
 
A

Andrew Webster

Hi Marshall,

I've had a good idea. Since I'm running code that toggles database
properties already, I'm going to try adding a custom property, write a test
that checks it, and instead of wrapping stuff in #If... wrap it with the
test instead.

I'll try and remember to post the results.

Thanks for replying.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top