Microsoft KB Archive/124808

= Cannot Set Focus for Combination List-edit Box =

Article ID: 124808

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 95a
 * Microsoft Excel 5.0c
 * Microsoft Excel 5.0a for Macintosh

-



This article was previously published under Q124808



SYMPTOMS
In the versions of Microsoft Excel listed above, the focus on a dialog box cannot be set to the list component of a combination list-edit box by changing the tab order.



WORKAROUND
If you are using Microsoft Excel for Windows, use the SendKeys command as in the following Visual Basic example.

NOTE: You cannot send keystrokes to applications running under the Macintosh operating system.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.  In a dialog sheet that contains a combination list-edit box, click Tab Order on the Tools Menu. Select the edit box component of the combination list-edit box and use the Move arrows to move the edit box to the top of the tab order. Select the list box component of the combination list-edit box and use the Move arrows to move the list box to the second position of the tab order.  On a module sheet, enter the following Visual Basic subroutine: Sub ListFocusExample SendKeys "{tab}" Dialogsheets(1).Show End Sub 

When the subroutine is executed, the SendKeys command will tab to the list component of the combination list-edit box, giving it the focus immediately after the dialog box is displayed.



MORE INFORMATION
In the versions of Microsoft Excel mentioned above, the focus on a dialog box is determined by the tab order of the elements in the dialog box. The first item in the tab order is designated to have the focus when the dialog box is displayed. When a combination list-edit box is created, it consists of two components: an edit box, which holds the currently selected value and allows user input, and a list box containing a set of possible values from which to choose. If the first item in the tab order is set to the list component of a combination list-edit box, the focus will be set to the next available item in the tab order.

