如何通过 VBA 以编程方式关闭 Microsoft Word 文档中的波浪形红线?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3822103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 12:07:46  来源:igfitidea点击:

How do I programmatically turn off the wavy red lines in a Microsoft Word document via VBA?

vbams-wordspell-checking

提问by GeneQ

Is there anyway to disable spell checking on a per document basis via VBA for MS Word?

无论如何,是否可以通过 VBA for MS Word 在每个文档的基础上禁用拼写检查?

回答by Dirk Vollmar

You can mark the current document as already spell-checked:

您可以将当前文档标记为已进行拼写检查:

ActiveDocument.SpellingChecked = True

or you can disable spell checking for a range of text:

或者您可以对一系列文本禁用拼写检查:

ActiveDocument.Range.NoProofing = True

You can also simply disable the displayof the red squiggles:

您也可以简单地禁用红色波浪线的显示

ActiveDocument.ShowSpellingErrors = False


Note that the same things can be done for grammar-checking (green squiggles); e.g.:

请注意,语法检查也可以做同样的事情(绿色波浪线);例如

ActiveDocument.GrammarChecked = True

will mark the current document as already grammar-checked, thus effectively disabling it.

会将当前文档标记为已经过语法检查,从而有效地禁用它。

回答by Lunatik

ActiveDocument.ShowSpellingErrors = False