Table of contents
Collapse the table of content
Expand the table of content

AddFromFile Method (VBA Add-In Object Model)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

For the References collection, adds a reference to aproject from a file. For the CodeModule object, adds the contents of a file to amodule. Syntaxobject.AddFromFile(filename) The AddFromFile syntax has these parts:

objectRequired. An object expression that evaluates to an object in the Applies To list.
filenameRequired. A string expression specifying the name of the file you want to add to the project or module. If the file name isn't found and a path name isn't specified, the directories searched by the Windows OpenFile function are searched.

Remarks For the CodeModule object, the AddFromFile method inserts the contents of the file starting on the line preceding the firstprocedure in thecode module. If the module doesn't contain procedures, AddFromFile places the contents of the file at the end of the module.

© 2018 Microsoft