You are here: Scripting Techniques > Working with Scripts > Creating a Global Script Module

Creating a Global Script Module

If you have multiple scripts that perform similar tasks, you can simplify your code by moving the common statements to a separate procedure, then calling the procedure directly from the original scripts. Normally, scripts cannot contain subroutines or functions, but if a script is designated as a global script it can contain them.

You can designate a script as a global module by choosing a name that does not begin with a letter, such as (General). For more specific instructions, see Creating a New Script.

Since a script specified as a global script is treated as a repository for multiple Sub and Function declarations, Doc-To-Help will not wrap the body of the script with Sub and End Sub statements.

You cannot assign a global script module to a style.