Ribbon Invalidate error 91

T

tighe

i am trying to invalidate a ribbon button on the close of a form because
depending on the client you enter the button can or cannot be available.

using the information from
:http://msdn.microsoft.com/en-us/library/dd548011.aspx, i ended up with:

Public gobjRibbon As IRibbonUI

Public Sub OnRibbonLoad(objRibbon As IRibbonUI)
Set gobjRibbon = objRibbon
End Sub

Public Function InvalidateFirmControls()
With gobjRibbon
.InvalidateControl "cmdNMA" 'Object variable not set (Error 91)

End With
End Function

i tried calling this from unload event but no change in error. Any
suggestions on how to change the process or correct?
 
T

tighe

mark,

Thank you the suggestion. I have been to that site before and it got me
started creating a more dynamic ribbon, i'll see what happens, and if
coporate will let me download from them.

i think i found the solution by adding the invalidate before enabling the
item, so far so good:
Public Sub GetEnabled(ctl As IRibbonControl, ByRef Enabled As Variant)

gobjRibbon.InvalidateControl "cmdNMA" 'no error and enables correctly

Select Case ctl.ID

Case "cmdNMA": Set Enabled = Forms![Firm_Address]![BD]
Case "cmdEmailRev": Set Enabled = [Forms]![001_Start]![EmailReview]

End Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top