Another way --
in Signatures ...
Option Explicit
Public oRibbon As IRibbonUI
Public bBeenRun As Boolean
'Callback for customUI.onLoad
Public Sub Ribbon_OnLoad(ribbon As IRibbonUI)
Set oRibbon = ribbon
bBeenRun = False
End Sub
'Callback for HLR_PageSetup getEnabled
Sub AlreadyRun(control As IRibbonControl, ByRef returnedVal)
returnedVal = Not bBeenRun
End Sub
'Callback for HLR_PageSetup getScreentip
Sub PageSetupTip(control As IRibbonControl, ByRef returnedVal)
Dim b As Boolean
Call AlreadyRun(control, b)
returnedVal = IIf(b, "Click to run PageSetup", "PageSetup can only be run once")
End Sub
In PageSetup
'Callback for 'HLR Page Setup' onAction
Sub rxbtnHLR_PageSetup_click(control As IRibbonControl)
bBeenRun = True
oRibbon.InvalidateControl ("HLR_PageSetup")
Call HLR_PageSetup
MsgBox "pagesetup run"
End Sub
Tweak to the CustomUI XML to use getEnabled and getScreentip callbacks
<button
id="HLR_PageSetup"
label="Page Setup"
showLabel="false"
size="large"
image="HLR-32x32"
onAction="rxbtnHLR_PageSetup_click"
description="HLR Page Setup"
getEnabled = "AlreadyRun"
getScreentip="PageSetupTip"
supertip="Formats page view, insert signature of user and inserts the current date."/>
I attached my effort, but rename off the .zip part if you want to see it
You can 'program around' the Boolean flag, I use things like that to keep things obvious (I get myself into trouble when I try to be TOO clever)