Applies To
Module Object.
Description
Adds text from a file to the end of the module.
Syntax
object.InsertFile(fileName, merge)
object
Required. The Module object.
fileName
Required. The name of the file containing the text that you wish to insert.
merge
Optional. If True, the new file is merged, so that all declarations are at the top of the module and all procedures are below the declarations. If False or omitted, the new file is inserted at the insertion point.
Remarks
You cannot insert text into a running code module. This applies both to running procedures as well as modules containing code that is stacked waiting to run after the current procedure returns.
Example
This example adds text from a file to Module2. Note that you cannot use the InsertFile method to add text to the module that contains the running example. Run the example from Module1 after inserting a new macro module (Module2).
Modules("Module2").InsertFile fileName:="MYMACRO.TXT"