Great thanks to Bernie Brooks for his kind replies & support. Try this code to get the Text Value of the msoControlEdit CommandBarControl. Code:
Dim CB As CommandBar Dim Cbc As CommandBarControl '''link the open event to function CreateBar...
Function CreateBar() '''' creates Commandbar
On Error Resume Next Application.CommandBars("thisBar").delete
Set CB = CommandBars.Add(NAME:="thisBar", Position:=msoBarTop, MenuBar:=False, Temporary:=True) CB.Protection = msoBarNoMove
Set Cbc = CB.Controls.Add(Type:=msoControlEdit) With Cbc '''enter text in msoControlEdit and press enter, then function getText runs. .OnAction = "getText" .Width = 100 .Caption = "TextonBar" '''we use the caption name to referece msoControlEdit control .Enabled = True End With
CB.Visible = True End Function
''''' get msoControlEdit text value Function getText() Dim str1 As String