4

Is it possible to put textbox control in custom toolbar in Excel. I have created an Add-in that shows this toolbar. What I want to do is when user types in textbox Add-in should call a procedure or function depending what user has typed.

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

Thanks.

1
  • What version of Excel are you using ? (Ribbon UI or Command Bars?) Commented Apr 17, 2009 at 0:59

2 Answers 2

4

If you are using Excel 2007 and have implemented IRibbonExtensibility::GetCustomUI then you can use the following XML to define an edit box in your Addin GUI:

<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>
Sign up to request clarification or add additional context in comments.

2 Comments

That looks good. I should consider to upgrading to 2007. Thank you.
When I get a chance I can give you the code for 2003, walking out the door right now ;)
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.