Alison Balteramp;#039;s Mastering Microsoft Office Access 1002003 [Electronic resources]

Alison Balter

نسخه متنی -صفحه : 544/ 211
نمايش فراداده

Importing and Exporting Code Modules

The Access 2003 VBE allows you to import code or form modules into, and export code modules from, a database. To export a form or code module, take the following steps:

  • Activate the VBE.

  • Within the Project Explorer window, right-click the object you want to export.

  • Select Export File. The Export File dialog box appears (see Figure 12.6).

    Figure 12.6. The Export File dialog box allows you to export a VBA module.

  • Select a location and name for the exported file and then click Save.

  • When you export a module, it is exported as an ASCII text file. You can import the text file into another Microsoft Access database, into any other Microsoft Office product (for example, Microsoft Excel), or into a Visual Basic project.

    NOTE

    If you export a Form module from the VBE, Access exports only the Class module behind the form. It does not export any visual aspects of the form.

    Just as you can export a text file, you can import a text file. This allows you to add an existing module or form to a project. Access copies the file and imports it into the database. It does not affect the original file. To import a file into your Access database:

  • Activate the VBE.

  • Within the Project Explorer window, right-click and select Import File. The Import File dialog box appears (see Figure 12.7).

    Figure 12.7. The Import File dialog box allows you to import a text file into your database.

  • Locate and select the file you want to import, and then click Open.