拼写检查_拼写检查VBA或VB6 ActiveX文本框

拼写检查

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that follows allows you to easily do just that.

如果您曾经使用过Microsoft Word,那么您就会知道它具有良好的拼写检查器,并且您可能会想到,检查拼写的功能可能是添加到您的某些应用程序中的不错的功能。 好吧,下面的代码使您可以轻松地做到这一点。

A few things to note about the code.

有关代码的几点注意事项。

o Microsoft Word must be installed on your PC and on any of your users' PCs in order for this code to work

o必须在您的PC和任何用户的PC上安装Microsoft Word,此代码才能起作用

o No Reference to Word is required in your application

o您的应用程序中无需引用Word

o The code as shown will check spelling but you can also have it check grammar by changing the objDoc.CheckSpelling line  to objDoc.CheckGrammar

○代码所示将检查拼写,但你也可以拥有它通过改变objDoc.CheckSpelling线objDoc.CheckGrammar检查语法

o You can replace the textbox with a RichTextbox if you like and the code will work with it as well

o如果愿意,可以将文本框替换为RichTextbox,并且代码也可以使用

o In Excel you will need to remove the App.OleRequestPendingTimeout = 999999 line

o在Excel中,您将需要删除App.OleRequestPendingTimeo ut = 999999

o The code expects an ActiveX textbox named "Text1" and an ActiveX command button named "SpellCheck"

o该代码需要一个名为“ Text1”的ActiveX文本框和一个名为“ SpellCheck”的ActiveX命令按钮

The following is a picture of the code in action. (Talking about 'action', the desktop picture behind the spell checker is me being tossed out of a boat while white water river rafting:) )

以下是运行中的代码的图片。 (谈到“动作”,拼写检查器后面的桌面图片是我在激流泛舟时被抛出小船:)

Spellcheck.jpg

When the code is run, misspelled words are colored red and so after I clicked the 'Spell Check' button the word "nicly" was highlighetd in be red by Word.

运行代码时,拼写错误的单词被涂成红色,因此在单击“拼写检查”按钮后,单词“ nicly”被Word高亮显示为红色。

If you have any comments, questions or problems please let me know.

如果您有任何意见,疑问或问题,请告诉我。

Finally, if you find that this article has been helpful, please click the “thumb’s up” button below. Doing so lets me know what is valuable for EE members and provides direction for future articles. It also provides me with positive feedback in the form of a few points. Thanks!

最后,如果您发现本文对您有所帮助,请单击下面的“竖起大拇指”按钮。 这样做可以让我知道对EE成员有价值的内容,并为以后的文章提供指导。 它还以几点的形式为我提供了积极的反馈。 谢谢!

翻译自: https://www.experts-exchange.com/articles/8678/Spell-check-a-VBA-or-VB6-ActiveX-textbox.html

拼写检查


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部