在VBA中拼写检查Excel工作表 [英] Spell check an Excel sheet in VBA

查看:90
本文介绍了在VBA中拼写检查Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜寻了Internet,并且找到了解决此问题的几种可行解决方案,但我也想在这里提出.

I have scoured the Internet and I have found a handful of possible solutions to this issue, but I wanted to ask here as well.

目标是单击一个按钮,然后拼写检查整个工作表.

The goal is to click a button, and spell check an entire sheet.

这是一些代码

Sub spellCheck()

Sheet1.Cells.CheckSpelling
End Sub

我也发现了这一点

Sub SpellCheck()
Dim Checkword As String, Result As Boolean
Checkword = Selection.Value
Result = Application.CheckSpelling(Checkword)
Selection.Offset(0, 1) = Result
End Sub

有什么想法吗?都没有为我工作.谢谢!

Any ideas? Neither is working for me. Thanks!

推荐答案

您可以通过执行以下操作来检查整个工作簿:

You can check the whole workbook by doing something like:

Sub SpellCheck()

For Each sh In Worksheets
    Sheets(sh.Name).Cells.CheckSpelling
Next

End Sub

这将循环浏览整本书中的每一页,并对每本书进行一次拼写检查.我还不能弄清楚的是如何使拼写检查器实际上移到拼写错误的位置.因此,通过以上内容,您仅能获得拼写错误的列表,而没有上下文来评估它们.

this will cycle through each sheet in the entire book and run a spellcheck on each one. What I can't figure out yet is how to make the spell checker actually move to the position of the spelling error. So, with the above you just get a list of spelling errors with no context with which to asses them.

这篇关于在VBA中拼写检查Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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