Main Content

unregisterallevents

Unregister all event handlers associated with COM object events

Description

unregisterallevents(c) unregisters all events previously registered with COM object c. After calling unregisterallevents, the object no longer responds to any events.

example

Examples

collapse all

Unregister the event handlers from all Microsoft® Excel® workbooks events.

To run this example, create a workbook and register events.

myApp = actxserver('Excel.Application');
wbs = myApp.Workbooks;
wb = Add(wbs);
registerevent(wb,{'Activate' 'EvtActivateHndlr'; 'Deactivate' 'EvtDeactivateHndlr'})
eventlisteners(wb)
ans =

  2×2 cell array

    'Activate'      'EvtActivateHndlr'  
    'Deactivate'    'EvtDeactivateHndlr'

Unregister the event handlers.

unregisterallevents(wb)
eventlisteners(wb)
ans =

  0×0 empty cell array

Input Arguments

collapse all

COM object, specified as a function handle.

Limitations

  • COM functions are available on Microsoft Windows® systems only.

Version History

Introduced before R2006a