Excel: Setting the Focus in a Custom Dialog Box

Last reviewed: November 3, 1994
Article ID: Q71298
The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0
  • Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0

SUMMARY

By default, the focus of a dialog box will be the first item listed in the dialog box description unless a default OK or default Cancel button is used. The default button will then have the focus instead of the first item listed. However, it is possible to override or change these defaults and specify which item you prefer to have as the focus when the dialog box is displayed.

Note that in Microsoft Excel version 5.0, you can control the focus in a dialog box by using the Tab Order dialog box in the dialog sheet. For more information about the tab order in a dialog box in Microsoft Excel version 5.0, query on the following words in the Microsoft Knowledge Base:

   tab and order and defaultbutton

MORE INFORMATION

The focus can be set to another item by placing a number in the Init/Result column of the first row of the dialog definition. This number should correspond to the position of the preferred item in the dialog definition. Items are numbered starting with 1 and beginning with the second row of the dialog box definition table. For example, placing a number 2 in the Init/Result column of the first line will cause the item located in the third row of the dialog definition to be selected when the dialog box is displayed.

You will not be able to set the focus to items that are not editable, or can be chosen such as buttons or check boxes.

The dialog definition always contains one or more rows and seven columns. The Init/Result column is always the seventh column in the dialog definition.

REFERENCES

"Microsoft Excel User's Guide 2," version 4.0, page 281

"Microsoft Excel User's Guide," version 3.0, page 640


KBCategory: kbusage
KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0
3.00 4.0 4.00 cursor edit


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 3, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.