首页 > 解决方案 > MS Word 代码的 Visual Basic 不适用于日语

问题描述

标签: vbams-wordspell-checkingcjk

解决方案


至少有一个错误是 GrammaticalError,而不是 SpellingError。

您可以以与已有代码类似的方式循环浏览 GrammaticalErrors,但没有与 GetSpellingErrors 方法等效的方法。

例如你可以做

For Each Rng in ActiveDocument.Range.GrammaticalErrors
  ' Each GrammaticalError is just a Word Range, 
  ' It is not obvious exactly what the range "covers". Judging from your example
  ' the range "covers" the sentence.
  ' So do whatever you need here. This example just highlights each Rng
  Rng.HighlightColorIndex = wdYellow
End

Word 对象模型中只有两种类型的 ProofreadingError - wdGrammaticalError 和 wdSpellingError。


推荐阅读