重新检查文档的拼写与VBA代码不同 [英] Recheck Document For Spellings Not Same as VBA Code

查看:88
本文介绍了重新检查文档的拼写与VBA代码不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在添加字典后重新检查文档中的拼写.问题是以下代码(大部分来自宏记录器)

I want to recheck the spellings in a document after adding a dictionary. The problem is the following code (mostly from the macro recorder)

CustomDictionaries.Add FileName:="c:\test_dictionary.dic"

Application.ResetIgnoreAll
ActiveDocument.Range.SpellingChecked = False
ActiveDocument.Range.GrammarChecked = False

与Word 2007的 Word选项|校对|重新检查文档按钮产生的结果不同.该按钮会重新检查文档,您可以看到新添加的单词被删除为拼写错误.该代码没有明显的影响.

does not produce the same results as from the Word 2007's Word Options|Proofing|Recheck Document button. The button does recheck the document and you can see the newly added words get removed as misspellings. The code does not have any noticable affect.

我俯瞰什么?

推荐答案

我必须为一个项目做同样的事情,这种变通方法对我来说就是一种情况:

I've had to do the same thing for a project, an this workaround made it happen for me:

 'spellcheck the document
 ActiveDocument.Range.LanguageID = wdFrenchHaiti
 ActiveDocument.Range.LanguageID = wdEnglishUS

当您更改语言时,Word会重新检查拼写错误的范围.

When you change the language, Word rechecks the range for spelling errors.

这篇关于重新检查文档的拼写与VBA代码不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆