[英]I am writing a event code in personal.xlsb to do spell check inside a cell
[英]VB Spell Check Code issue
我已经设法汇编以下代码来对锁定的文档进行拼写检查,但无法退出就可以正常工作。 我希望它仅查看未锁定的单元格,但仍使用'CommandBars(“ Tools”)。Controls(“ Spelling ...”)。Execute'函数。 任何想法都很棒。 TIA
Sub SelectUnlockedCells_Spellcheck()
ActiveSheet.Unprotect Password:=""
Dim WorkRange As Range
Dim FoundCells As Range
Dim Cell As Range
Set WorkRange = ActiveSheet.UsedRange
For Each Cell In WorkRange
If Cell.Locked = False Then
If FoundCells Is Nothing Then
Set FoundCells = Cell
Else
Set FoundCells = Union(FoundCells, Cell)
End If
End If
Next Cell
If FoundCells Is Nothing Then
MsgBox "All cells are locked."
Else
FoundCells.CheckSpelling CommandBars("Tools").Controls("Spelling...").Execute
End If
ActiveSheet.Protect Password:=""
End Sub
您正在使用此代码
FoundCells.CheckSpelling CommandBars("Tools").Controls("Spelling...").Execute
但是VBA帮助没有显示任何此类参数。 尝试仅使用此:
FoundCells.CheckSpelling
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.