Visual Basic Extensibility Reference

BeforeLoadFile Event

See Also   Example   Applies To

Occurs when a component is added (not opened) to a project, or when a component's associated binary file (such as an .Frx file) is accessed.

Syntax

Subobject**_BeforeLoadFile(vbprojectAs VBProject**, *filenames()*As String)

The BeforeLoadFile event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
vbproject A VBProject object specifying the name of the project in which the file is to be loaded.
filenames A string expression specifying the names of the files to be loaded.

Remarks

This event occurs in all add-ins that are connected to the FileControl object. This event occurs several times for a project: once for the project file; once for all the forms, modules, classes, User controls, Property Pages, and control files; and once for each of the .Frx files. This event occurs if a form file with an associated .Frx file is saved, because the .Frx is loaded when the .Frm file is saved.

This event occurs in all add-ins that are connected to the FileControl object. The add-in cannot prevent the file from being written to disk because the operation is complete. However, you can use this event to perform other tasks, such as:

  • Log information about the event.

  • Update information about the file.

  • Back up the file.