Share via


EventsEnabled Property [Visio 2003 SDK Documentation]

Determines whether a Microsoft Office Visio instance fires events.

intRet = object**.EventsEnabled**

object**.EventsEnabled** = intExpression

intRet     Integer. False (0) if event firing is disabled; True (-1) if event firing is enabled.

object     Required. An expression that returns an Application object.

intExpression     Required Integer. False (0) to disable event firing; True (non-zero) to enable event firing.

Version added

4.5

Remarks

If the EventsEnabled property is False, Visio does not fire events, run add-ons, or execute strings that contain arbitrary Visual Basic for Applications (VBA) code when evaluating RUNADDON operands in cell formulas.

By default, the EventsEnabled property is True when an instance of Visio starts.

You may want to disable event firing if you have written code to handle events such as DocumentOpened or DocumentCreated that does not work properly, or to prevent the incorporation of a virus into a document. Events will not fire until the EventsEnabled property is set to True.

To set the EventsEnabled property to False in another way

  1. On the Tools menu, click Options.
  2. In the Options dialog box, click the Security tab.
  3. Clear the Enable Automation events check box.

Example

These VBA macros show how to use the EventsEnabled property to suspend and resume event processing.

Public Sub SuspendEventProcessing_Example() 

    'Suspend event processing.
    Application.EventsEnabled = False
    End Sub  

Public Sub EventsEnabled_Example() 

    'Resume event processing.
    Application.EventsEnabled = True

End Sub

Applies to | Application object | InvisibleApp object

See Also | DocumentCreated event | DocumentOpened event