Microsoft KB Archive/112771

= Microsoft Knowledge Base =

XL: Can't Use Dialog Method to Bring Up Spelling Dialog Box
Last reviewed: June 20, 1997

Article ID: Q112771

The information in this article applies to:


 * Microsoft Excel for Windows, version 5.0
 * Microsoft Excel for the Macintosh, version 5.0
 * Microsoft Excel for Windows 95, version 7.0

SYMPTOM
In Microsoft Excel, the Dialogs method in Visual Basic, Applications Edition, can be used to display over 200 built-in dialog boxes. However, the Spelling tool dialog box cannot be shown using the Dialogs method.

CAUSE
The Spelling tool dialog box cannot be shown using this method because it does not have a defined constant in Microsoft Excel.

WORKAROUND
This problem only affects the ability to display the dialog box for the Spelling tool. You can run the Spelling tool by using the CheckSpelling method as in the following example:

ActiveSheet.CheckSpelling

MORE INFORMATION
The Dialogs method can be used to display various built-in Microsoft Excel dialog boxes. For example, the following Visual Basic, Applications Edition, procedure uses the Dialogs method and the constant xlDialogOpen to show the Open dialog box (the dialog box you get when you choose Open from the File menu):

Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

Sub ShowFileOpen Application.Dialogs(xlDialogOpen).Show End Sub To look up constants with the Object Browser


 * 1) In a Visual Basic module, choose Object Browser from the View menu.
 * 2) From the Libraries/Workbooks list, select Excel.
 * 3) From the Objects/Modules list, select Constants.

A list of the built-in constants appears in the Methods/Properties list box. To find the dialog box constants, scroll the list until you find the constants that begin with xlDialog. These constants correspond to dialog box names; for example, the constant for the Find File dialog box is xlDialogFindFile.

For more information about using constants in Microsoft Excel and Visual Basic, query on the following words in the Microsoft Knowledge Base:

appnote and constants and using and visual and basic