Searching I found code to spell check a text box on a userform. I created the following function.
Public Function SpellCheck(ByRef SC_TextBox As MSForms.TextBox) As Boolean Dim varWords As Variant Dim ndx As Long Dim lngLen As Long varWords = Split(SDebug.Print Timer For ndx = LBound(varWords) To UBound(varWords) If Not Application.CheckSpelling(Word:=varWords(ndx), IgnoreUppercase:=True) Then With SC_TextBox .SelStart = lngLen .SelLength = Len(varWords(ndx)) .SetFocus End With SpellCheck = False Exit Function Else lngLen = lngLen + Len(varWords(ndx)) + 1 End If Next ndx SpellCheck = True End Function
It works fine except that it is very slow. With everything spelled correctly a text box with 34 words takes 27 seconds to run. One with 11 words takes 10 seconds. It is the Application.CheckSpelling that is taking a long time. Anyone have any suggestions on speeding this up?