BeforeItemCut 事件

       

从文件夹中剪切项目时发生。该方法在开始后可以取消。如果事件被取消,将不删除项目。

Private Sub explorer_BeforeItemCut(Cancel As Boolean)

explorer  该表达式返回一个 Explorer 对象。

Cancel  可选。当事件发生时为 False。如果事件过程将该参数设置为 True,则不完成该操作,并且不删除项目。

示例

以下示例在从文件夹中剪切项目前向用户弹出一条警告消息。如果用户单击“是”,就从文件夹中剪切项目。如果用户单击“否”,将不从文件夹中删除项目。

Private Sub objExplorer_BeforeItemCut(Cancel As Boolean)
'prompts the user before cutting an item

   Dim lngAns As Long 'user answer
   'Display question to user
   lngAns = MsgBox("Are you sure you want to cut the item?", vbYesNo)
   'Set cancel argument based on answer
   If lngAns = vbYes Then
       Cancel = False
   ElseIf lngAns = vbNo Then
       Cancel = True
   End If

End Sub