![](/img/trans.png)
[英]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.