Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
To check the spelling in a document, use the CheckSpelling method. This method returns a Boolean value that indicates whether the supplied parameter is spelled correctly.
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. For more information, see Features available by Office application and project type.
Call the CheckSpelling method and pass it a range of text to check for spelling errors. To use this code example, run it from the ThisDocument
or ThisAddIn
class in your project.
string result = "Spelled incorrectly.";
object startLocation = this.Content.Start;
object endLocation = this.Content.End;
bool spellCheck = this.Application.CheckSpelling(
this.Range(ref startLocation, ref endLocation).Text);
if (spellCheck == true)
{
result = "Spelled correctly.";
}
MessageBox.Show(result);
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!