ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   spell check a textbox (https://www.excelbanter.com/excel-programming/287883-spell-check-textbox.html)

KimberlyC

spell check a textbox
 
Hi

I have a text box in my excel spreadsheet.
I need to allow user to run spell check on the text they input into it.
Is there a way to spell check it using code??


Thanks in advance for your help!
Kimberly



Jake Marx[_3_]

spell check a textbox
 
Hi Kimberly,

Something like this may do what you're looking for:

Private Sub TextBox1_LostFocus()
Dim v As Variant

For Each v In Split(TextBox1.Text)
If Not Application.CheckSpelling(v) Then _
MsgBox "'" & v & "' is not a valid word.", _
vbExclamation
Next v
End Sub

This code should be placed in the Worksheet class module that the TextBox is
on. Just change all instances of "TextBox1" to the name of your TextBox.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


KimberlyC wrote:
Hi

I have a text box in my excel spreadsheet.
I need to allow user to run spell check on the text they input into
it. Is there a way to spell check it using code??


Thanks in advance for your help!
Kimberly




All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com