The On_Update_UI
macro is called when it might be necessary for a script to update a toolbar button or menu item's
enable status, so that you can enable/disable toolbar buttons and menu items that run macros. The
Application.DisableMacro
method is provided for this
purpose--it will disable the toolbar button, menu item, and shortcut key associated with the
macro (but will not remove it from the Macros
dialog or
Macros
toolbar). When On_Update_UI is called, any macros
that were disabled the last time On_Update_UI was executed are automatically
enabled again.
On_Update_UI is not allowed to modify the document.
If On_Update_UI is not defined, all toolbars and menu items with macros are enabled.
On_Update_UI is called when:
Here is an example of disabling a macro in On_Update_UI:
<MACRO name="MyCutMacro" key = "" lang="VBScript" hide="true"> Selection.Cut </MACRO> .... <MACRO name="On_Update_UI" key="" lang="VBScript" hide="true"> if (Selection.IsInsertionPoint) Then Application.DisableMacro("MyCutMacro") End If </MACRO>
To see how this macro works:
Note: Since DisableMacro() does not remove the macro from the Macros dialog or Macros toolbar, if you want this macro to be available only from its menu item, toolbar button, or shortcut key, you should set its `hide' attribute to `true' (you should do this after you associate the macro with a toolbar and/or menu item).
Copyright © SoftQuad Software Inc. 1999