I've created a command bar for right click on a control in a form with something like this:
(it's been hacked together here for demonstration from different procedures and forum suggestions)
Code:
Dim cbrRc As Object
Set cbrRc = fResetCbr(Fcntl(1, 15)) 'Fcntl(1,15) has a name for the control bar right click menu
With cbrRc.Controls.Add(msoControlButton)
.Caption = fTranltLang(TempVars!LoLangID, "3_RcfSearch", "LF") 'Translates the button into different languages
.OnAction = "=f" & Fcntl(1, 15) & "Search()" 'The function name is built for use in the form class module
.Enabled = False
End With
'more buttons added below
---
Public Function fResetCbr(aBarName As Variant) As Office.CommandBar
'Delete bar if it exists, must be called with set from another procedure
On Error Resume Next
CommandBars(aBarName).Delete
On Error GoTo 0
Set fResetCbr = CommandBars.Add(aBarName, 5) ', False, True)
End Function
In another procedure for a form control, I need to make the "Search" button enabled.
I'm going cross-eyed trying to figure out the syntax to modify just that one button.
What is the syntax?
Is there also a way to "id" the "Search" button, so I can reference it in a simpler manner (than the foreign language caption)?
Thanks