First of all, a big thank you to one of my subscribers (Bob) for giving me the idea and inspiration to mention a little about how to manage Microsoft Access VBA modules by importing and exporting files between VBA projects in Microsoft Access (and other Office applications).
Access VBA programmers will experience a little deja-vu when wanting to re-use code and without having to physically open to copy VBA code and then close Access databases, you can simply learn to build a library of code by having separate files as exported and then import as required.
How to Export Microsoft Access VBA code?
Locate the module or form code you wish to export which means you need to be in the Visual Basic Editor view (ALT + F11 function key).
Right mouse click the node to export and modify the name (if required).
Microsoft Access VBA modules are saved with the file extension .bas and is essentially a text file. To save VBA code from an Access form, it uses the extension .cls and only the VBA code is exported (not the form design).
How to Import Microsoft Access VBA code?
Locate the module or form code you wish to import which means you need to be in the Visual Basic Editor view (ALT + F11 function key).
Right mouse click anyway in the VBA Project view to import and locate either the .bas or .cls file.
When importing a .cls file (which is a class file), you only import Microsoft Access VBA code which sits in a folder called Class Modules and will require some maintenance by cutting and pasting code to the matching form (if present).
Microsoft Access Database Tutorial – My Tips
It’s better to only export modules and not code from Access forms as the normal practice is to re-use VBA code publicly (hence a module) and not code privately (via a form).
Microsoft Access VBA modules are great for storing all your functions and generic procedures and can be imported with ease into any Microsoft Access database.
Outside the scope of Microsoft Access, this technique is also used with Excel, Word, PowerPoint, Project and Outlook with the additional file extension .frm (User Forms).
Please feel free to post your comments below as I would be interested if you think this is a useful practice and those who have used this, what sort of code procedures so you share and re-use?
Tags: access database vba, how to import vba code, how to save access vba modules, importing access vba modules, microsoft access database tutorial
Before you can import and export code, make sure you have removed any password protected modules (vba project) as it will prevent you from completing this task.
I wanted help about access 2007
I am created database by using access 2007 and created forms in database
just i need database to files *.exe application how to steps please help me
what steps about this question
In Access 2007, you have the option to create an accde (which is an executable file) not an .exe. In order to create a an .exe you will need to use a dedicated programming appliatiions namely Visual Basic.Net.
In the meantime, to create and accde, see https://accessdatabasetutorial.com/2011/02/07/converting-a-microsoft-access-database-file-to-a-mde-file-or-accde-file
i am new using msoffice access
i am using msaccess 2003, i creating one database, the problem is ,how can i create one button to import or export files from pc1 to pc2,this 2 pc have same database program in msaccess, but pc1 is alway updates,so want to export files to disc/disket and then go to pc2 ,just click button import,and database updates!
can u teah me how?on easy way…no hard way…
This can be taught but how easily depends on the knowledge you may (or may not) have. Using macros and VBA code yu can do virtually anything but it would need a plan of action before I could suggest a good approach. My eBooks (and some products) come with email support as a bonus gift which may be an introduction to having someone assist you – https://accessdatabasetutorial.com/ebooks/