[AccessD] Help with creating an Excel Conditional Format from within Access

Mark Simms marksimms at verizon.net
Thu Feb 2 23:19:03 CST 2012


See prior posts in this list.....regarding Compiler Directives.
That's one way to do it.
I know that Office sometimes doesn't re-link the references for a new Office
environment.
You'll need one declaration at the top of a module:
#Const OFFICEVERSION=14 ' change this ONE line of code for each target
environment 12,11,10, etc.
#Const OFFICE2003=11
#Const OFFICE2007=12
#Const OFFICE2010=14
Then you will need a block of if-then-else statements to handle each
environment

Below could be placed into a separate Procedure in a module....or in a
special start-up form "frmCompile" for instance.
In any case, this must be done once each and every time you deploy a new
version of your app.

#If OFFICEVERSION=OFFICE2003 Then
SetReferences OFFICE2003
#Elseif OFFICEVERSION=OFFICE2010 Then
SetReferences OFFICE2010
...Etc....
#End If

You'll need to code a SetReferences procedure in a module.
This proc will remove all broken references....and then call the AddFromGuid
method
 to add the correct Office version of Excel (and other Office apps) to the
references.

In the end, you'll have 3 or 4 separate Access apps for each target
environment.
However, only 1 line of code will differentiate them:
#Const OFFICEVERSION=xx

Unfortunately, you'll need to re-compile the app from a machine that has the
specific Office release to be deployed.
It's best, of course, if you as developer have access to each and every
office environment.
If not, you are now reliant upon users for doing the above upon each new
release of your app.

Another alternative of course, is to have 4 or so versions of the app...each
with the proper references set.
Then just swap out and import the entire VBE object set of forms, modules,
classes, etc.





More information about the AccessD mailing list