Share via


Remove Method

Remove method as it applies to the FileTypes, PropertyTests, and SearchFolders objects.

Removes the specified object from the collection.

expression.Remove(Index)

*expression   * Required. An expression that returns one of the above objects.

Index   Required Long. The index number of the property test to be removed.

Remove method as it applies to the NewFile object.

Removes an item from the New <Item> task pane. Returns a Boolean.

expression.Remove(FileName, Section, DisplayName, Action)

*expression   * Required. An expression that returns a NewFile object.

FileName   Required String. The name of the file reference.

Section   Optional Variant. The section of the task pane where the file reference exists. Can be any msoFileNewSection constant.

DisplayName   Optional Variant. The display text of the file reference.

Action   Optional Variant. The action taken when a user clicks on the item. Can be any msoFileNewAction constant.

Remarks

The arguments supplied to the Remove method must match the arguments that were supplied to the Add method of the NewFile object, or the Remove method will fail. For example, if the Action    argument was supplied when the NewFile object was added, then the same Action    argument must be supplied to remove the NewFile object, or the Remove method will fail.

Remove method as it applies to the UserPermission object.

Removes the specified UserPermission object from the Permission collection of the active document.

expression.Remove()

*expression   * Required. An expression that returns a UserPermission object.

Remarks

The UserPermission object associates a set of permissions on the active document with a single user and an optional expiration date. The Remove method removes the user and the set of user permissions determined by the specified UserPermission object.

Example

As it applies to the FileTypes, PropertyTests, and SearchFolders objects

This example removes the first search criterion from the collection.

Application.FileSearch.PropertyTests.Remove(1)

As it applies to the NewFile object

This example removes the specified item from the Microsoft Word NewDocument task pane.

Sub RemoveDocFromTaskPane()
    Application.NewDocument.Remove FileName:="C:\Newfile.doc", _
            Section:=msoNewfromTemplate, DisplayName:="NewFile"
    CommandBars("Task Pane").Visible = True
End Sub

As it applies to the UserPermission object.

The following example removes the second user's permissions on the active document from the document's Permission collection.

    Dim irmPermission As Office.Permission
    Dim irmUserPerm As Office.UserPermission
    Set irmPermission = ActiveWorkbook.Permission
    Set irmUserPerm = irmPermission.Item(2)
    irmUserPerm.Remove
    MsgBox "Permission removed.", _
        vbInformation + vbOKOnly, "IRM Information"
    Set irmUserPerm = Nothing
    Set irmPermission = Nothing

Applies to | FileTypes Collection | NewFile Object | PropertyTests Collection Object | SearchFolders Collection | UserPermission Object