Hello:

I have a user form with a combo box that shows the style of the selection.
I'm displaying the user form in nonmodal fashion. How do I get that combo box
to have focus AND show the current text as being selected?

When ShowModal is True, using the SetFocus method highlights the combobox
text. When ShowModal is False, it doesn't. Neither do the SelStart and
SelLength properties work.

Any ideas?

Bear

RE: Selecting a combo box in a nonmodal user form by Bear

Bear
Tue Dec 13 11:21:02 CST 2005

To bring this thread up to date and conclude my search for an answer...
There's no "good" way to set the focus to a combobox in a modeless form. The
ugly workaround is to set focus to another control, then back to the combobox.

Here's what I ended up doing...

Sub ReplaceStyles()

' Replaces paragraph or character styles

Dim MyForm As frmReplaceStyles
Set MyForm = New frmReplaceStyles
MyForm.Show

' Workaround to set focus in modeless form

MyForm.cmdCancel.SetFocus
MyForm.cboFindStyleName.SetFocus

Set MyForm = Nothing

End Sub