共用方式為


How to: Programmatically check spelling in worksheets

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can programmatically check the spelling of words in a worksheet. The Spelling dialog box automatically appears if there are any incorrectly spelled words in the worksheet.

Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Excel. For more information, see Features available by Office application and project type.

To check spelling in a worksheet in a document-level customization

  1. Call the CheckSpelling method of the worksheet.

    Globals.Sheet1.CheckSpelling();
    
    Globals.Sheet1.CheckSpelling()
    

To check spelling in a worksheet in a VSTO Add-in

  1. Call the CheckSpelling method of the active worksheet.

    ((Excel.Worksheet)Application.ActiveSheet).CheckSpelling();
    
    CType(Application.ActiveSheet, Excel.Worksheet).CheckSpelling()
    

See also