I'd like to use the Excel Application.CheckSpelling method in a userfunction, but it seems not to work for some reason.
If I use it in a macro, say one activated when the sheet content changes, it works fine, correctly spelled words return TRUE and incorrectly spelled words return FALSE.
However, when I use it in a userfunction it always return FALSE.
According to the help, there seems to be no reason why this should be the case when it is used in this way. Anybody have any ideas what the problem is and if there might be a fix?
Here are examples of the codes that do and do not work:
This works - it inserts TRUE or FALSE into the cell to the right of a changed cell depending on whether the change cell contains a correctly spelled word:
This does not work:Code:Private Sub Worksheet_Change(ByVal target As Excel.Range) If target.Text <> "" And target.Text <> "FALSE" And target.Text <> "TRUE" Then target.Offset(0, 1) = Application.CheckSpelling(target.Text) End If End Sub
I am running on XP and have tried the above in Excel in both Office 2003 and Office 97 with the same problem in both cases.Code:Public Function chkspell(ByVal target As Range) As Boolean chkspell = Application.CheckSpelling(target.Text) End Function
Any suggestions would be appreciated.
Tony


Reply With Quote