Key Concepts > Sharing and Referencing Macros |
Consider the following options for macros you want to share:
Choosing Whether to Save Your Macro in a Session or Common Project
Saving a macro directly to a session document makes it easy for you to run and distribute that macro. To run the macro, you can either open the session document in InfoConnect or reference the document in the Visual Basic Editor.
Saving a macro in the Common project allows you to run the macro from any session document.
Create macros in... |
To |
an InfoConnect session document. |
run a macro from a single session document. -or- reference the macro from another session document. (See Controlling Macro Execution.) |
the Common project |
run a macro from any session document on the computer. |
An additional option for sharing Visual Basic code is to export code module (.bas), class (.cls), and form (.frm) files. InfoConnect users can import these files directly to an InfoConnect project in Visual Basic to add new functionality to session documents without altering existing macros.
![]() |
Note: You cannot use macro files to run macros that use forms or that call other subroutines, in your Visual Basic Project. For example, any recorded macro will run successfully after it has been exported to a macro file, because all the code in any recorded macro file is contained within a single subroutine. However, let’s say you have two macros: a recorded macro (MacroA), and a second macro (MacroB) which includes a call to MacroA. MacroB would not run correctly after being exported to a macro file, because the code in MacroA is not included in its exported file. |