In addition to having VBA create code modules, it might be easier to have a template somewhere on the network, copy the code module (with some minor custom information in code).
How to Copy A Module From One Project To Another
( I am not going to post the code on how to create a new Event Procedure, but with this information poeple can search MSDN)
Note: There is no direct way to copy a module from one project to another. To accomplish this task, export the module from the Source VBProject and then import that file into the Destination VBProject.
ModuleName is the name of the module you want to copy from one project to another.
FromVBProject is the VBProject that contains the module to be copied. This is the source VBProject.
ToVBProject is the VBProject in to which the module is to be copied. This is the destination VBProject.
OverwriteExisting indicates what to do if ModuleName already exists in the ToVBProject. If this is True the existing VBComponent will be removed from the ToVBProject. If this is False and the VBComponent already exists, the function does nothing and returns False.
The function returns True if successful or False is an error occurs. The function will return False if any of the following are true:
•FromVBProject is nothing.
•ToVBProject is nothing.
•ModuleName is blank.
•FromVBProject is locked.
•ToVBProject is locked.
•ModuleName does not exist in FromVBProject.
•ModuleName exists in ToVBProject and OverwriteExisting is False.
Bookmarks