Skip to main content

IRibbonUI.Invalidate method

Table of contents
  1. Syntax
  2. Remarks
  3. Example

Invalidates the cached values for all of the controls of the Ribbon user interface.



expression An expression that returns an IRibbonUI object.


You can customize the Ribbon UI by using callback procedures in COM add-ins. For each of the callbacks that the add-in implements, the responses are cached.

For example, if an add-in writer implements the getImage callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in place until the add-in signals that the cached values are invalid by using the Invalidate method, at which time, the callback procedure is again called and the return response is cached. The add-in can then force an immediate update of the UI by calling the Refresh method.


In the following example, starting the host application triggers the onLoad event procedure that then calls a procedure that creates an object representing the Ribbon UI. Next, a callback procedure is defined that invalidates all of the controls on the UI and then refreshes the UI.

<customUI xmlns="" onLoad="MyAddInInitialize">
			<tab id="customTab" label="MyTab" insertAfterMso="TabHome">
				<group id="customGroup" label="Custom Tab">
					<button id="customButton" label="Custom Button" imageMso="HappyFace" size="large" onAction="Callback" />
Dim MyRibbon As IRibbonUI
Sub MyAddInInitialize(Ribbon As IRibbonUI)
    Set MyRibbon = Ribbon
    MyRibbon.Invalidate 'Invalidates the caches of all of this add-in's controls
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>