DetachEvents Method (Scripting Object)

Object: Scripting Object

Detaches an object's event sources from script functions with a given prefix.

Usage

Scripting.DetachEvents (ByVal Object As Object, ByVal ObjectName As String) As Boolean

Arguments

Object

The object from which you want to detach.

ObjectName

Prefix string used to map the object events for this instance. When the object fires an event named Foo, the script engine calls a subroutine named EventPrefix_Foo.

Return Values

Boolean indicating whether the method succeeded (True) or failed (False).

Examples

' Detach application object from its event handlers with prefix appEvents 
Dim app 
Set app = GetObject(, "MGCPCB.Application") 
Call Scripting.DetachEvents(app, "appEvents")