Text box in custom toolbar

Is it possible to put a text box control in a custom toolbar in Excel. I created an add-in that shows this toolbar. What I want to do is when user types in a text box add-in should call a procedure or function depending on what the user typed.

I would like to do this in VBA in MS Excel.

Thanks.

+3
source share
2 answers

I found out:

Sub test()
    Set myControl = CommandBars("Test").Controls.Add(Type:=msoControlEdit, Before:=1)
    With myControl
        .Caption = "Search"
        .OnAction = "Tester"
    End With
End Sub


Sub Tester()
    MsgBox "I am gonna search for: " & CommandBars("Test").Controls(1).Text
    CommandBars("Test").Controls(1).Text = ""
End Sub
0
source

Excel 2007 IRibbonExtensibility:: GetCustomUI, XML Addin:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon startFromScratch="false">
        <tabs>
            <tab id="MyTab" label="My Tab">
                <group id="MyGroup" label="My Group">
                    <editBox id="MyEditBox" getText="MyEditBoxCallbackgetText" label="Editbox Label" onChange="MyEditBoxCallbackOnChange"/>
                 </group>
            </tab>
        </tabs>
    </ribbon>
</customUI>
+3

Source: https://habr.com/ru/post/1706565/


All Articles