Visio2000: Sample Macro to Disable Modal and Alert Dialog Boxes (279710)



The information in this article applies to:

  • Microsoft Visio 2000 Standard Edition
  • Microsoft Visio 2000 Professional Edition
  • Microsoft Visio 2000 Technical Edition
  • Microsoft Visio 2000 Enterprise Edition

This article was previously published under Q279710

SUMMARY

This article contains a sample Microsoft Visual Basic for Applications macro (Sub procedure) to disable modal and alert dialog boxes in Microsoft Visio.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Sample Macro

When you perform certain actions, Visio displays a message that requires you to click a response, such as OK, Yes, No, or Cancel. For example, when you close a document that contains unsaved changes, Visio prompts you to save the changes.

To prevent Visio from displaying such messages, you can set the AlertResponse property to a default value for all responses. Visio then does not display the messages, but continues as if you responded with the value of the AlertResponse property.

The following sample macro uses the AlertResponse property to automatically respond to all Visio alerts and modal dialog boxes:
Public Sub KillDialogs()

   Application.AlertResponse = 1

End Sub
If you set the AlertResponse property to 0 (its default value), all messages are displayed.

The values that you supply for the AlertResponse property correspond to the following standard Microsoft Windows constants:
ConstantValue
IDOK1
IDCANCEL2
IDABORT3
IDRETRY4
IDIGNORE5
IDYES6
IDNO7

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbhowto KB279710