I have this code for Spell check, it works fine except when the information inputted in the text box is longer than the textbox can show at once (if that makes sense?). I get a type mismatch error.
The code sends the information to a hidden sheet ("Spelling") runs the spell check and then replaces the text in the textboxes with the corrected text.
Is there anything in my code which I could change, or is it to do with the properties of the multiline textbox?
The code sends the information to a hidden sheet ("Spelling") runs the spell check and then replaces the text in the textboxes with the corrected text.
Code:
Private Sub cmdSpellCheck_Click()
Dim SpellCheck As String, _
SpellCheck1 As String
If (Application.CheckSpelling(txtDetails.Text) = True) And (Application.CheckSpelling(txtOther.Text) = True) Then
MsgBox "Spell check returned no errors"
Else
SpellCheck = txtDetails.Text
SpellCheck1 = txtOther.Text
Application.Worksheets("Spelling").Cells(1, 1).Value = SpellCheck
Application.Worksheets("Spelling").Cells(2, 1).Value = SpellCheck1
'Now Check spelling
Worksheets("Spelling").CheckSpelling AlwaysSuggest:=True
txtDetails.Text = ThisWorkbook.Worksheets("Spelling").Cells(1, 1).Text
txtOther.Text = ThisWorkbook.Worksheets("Spelling").Cells(2, 1).Text
End If
End Sub
Is there anything in my code which I could change, or is it to do with the properties of the multiline textbox?