RequestChangeFileName Event

Visual Basic Extensibility Reference

Visual Studio 6.0

RequestChangeFileName Event

See Also   Example   Applies To

Occurs after specifying a new filename for a component or project, and the name change is completed.


Sub RequestChangeFileName(vbproject As VBProject, filetype As vbext_FileType, newname As String, oldname As String, cancel As Boolean)

The RequestChangeFileName event syntax has these parts:

Part Description
vbproject A VBProject object specifying the name of the project the new file will be added to.
filetype An enumerated value (vbext_FileType) specifying the type of file that was written, as listed in Settings.
newname A string expression specifying the name given to the renamed file.
oldname A string expression specifying containing the name of the file before it was renamed.
cancel A Boolean expression that determines the default Visual Basic action, as described in Settings.


The settings for filetype are:

Constant Value Description
vbext_ft_Form 0 File type is a form.
vbext_ft_Module 1 File type is a basic module.
vbext_ft_Class 2 File type is a class module.
vbext_ft_Project 3 File type is a project.
vbext_ft_Exe 4 File type is an executable file.
vbext_ft_Res 6 File type is a resource file.
vbext_ft_UserControl 7 File type is a User control.
vbext_ft_PropertyPage 8 File type is a Property Page.
vbext_ft_DocObject 9 File type is a User Document.
vbext_ft_Binary 10 File type is a binary file.
vbext_ft_GroupProject 11 File type is a group project.
vbext_ft_Designer 12 File type is a designer object.

The settings for cancel are:

Setting Description
True Cancel the renaming of the file. This event won't be triggered for any subsequent add-ins connected to the FileControl object.
False Continue triggering this event for subsequent add-ins connected to the FileControl object.


This event allows all the add-ins to examine the new filename that is proposed to be added to the project, and decide whether to accept or cancel the name change.

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.
© 2016 Microsoft