Ellipsis text box for V User User

I am trying to create a path selection user interface for the extensive VBA program I was working on, but I cannot get the ellipsis text box that I would like. This is a very common feature, especially in option tables. This is an example of what I would like to get right from the VBA Options panel:

ellipsis_textbox_example

I would LOVE to find a way to get the same functionality in Userform. The only solution I have found so far is to use a combo box with the elliptical arrow option turned on. However, there seems to be no obvious way to use combo arrow activation to launch a dialog box, and there seems to be no way to make it look UNLIKE in the combo box. Last resort I use the button under the text box, but I would prefer a less cumbersome way to do this.

It would be helpful to get any solution.

+4
source share
2 answers

, , . , , , , , UNLIKE a

, , , , , Button + Textbox.

.

1)

         DropButtonStyle = fmDropButtonStyleEllipsis

, , , design-time:

         ShowDropButtonWhen = ShowDropButtonWhenFocus

2) , . .

3) . . . ( : , ComboBox1.DropDown)

Private Sub ComboBox1_DropButtonClick()
    ' The following two lines avoid to call the routine twice, at entry and at exit
    Static i As Integer
    i = (i + 1) Mod 2: If i = 0 Then Exit Sub

    With ComboBox1
        s = InputBox("enter some text", , .Value) '<~~ simulates any dialog
        If s <> "" Then .Value = s
        SendKeys ("{Enter}") '<~~ to close immediately the dropdown window
    End With
End Sub

;)

+3

ComboBox Drop Buttons, TextBox ( Excel RefEdit). , Dropbox , . combobox.

TextBox1 :

Private Sub UserForm_Initialize()
  With Me.TextBox1
    .DropButtonStyle = fmDropButtonStyleEllipsis
    .ShowDropButtonWhen = fmShowDropButtonWhenAlways
  End With
End Sub

DropButtonClick , :

Private Sub TextBox1_DropButtonClick()
  '' Code here to do what you need
End Sub

Excels Flaky RefEdit Control, "" RefEdit Excel.

0

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


All Articles