Tuesday, March 26, 2013

How to create a reusable VBA code base

(This post is based on work done in Access 2010.) Over time, you will no doubt find or create useful VBA functions that can be used in multiple Access or Excel applications. These functions probably won't ever change or will need to be updated infrequently. Rather than copying and pasting your functions into multiple Access databases, you can put the code you want to reuse in a module in a database on your network. Then you can set the database as a reference in databases that need to use your functions. Here's how you do it:
  • Open the Visual Basic editor in your Access database.
  • Go to Tools-->References.
  • Click Browse.
  • Browse to the location of the Access database that contains the code you want to reuse.
  • Change the Files of Type selector if necessary.
  • Click Open.
  • Make sure the checkbox next to your code base database is checked in the list of Available References.
  • Click OK.

No comments:

Post a Comment