ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.CheckSpelling Error in Macro (https://www.excelbanter.com/excel-programming/296892-application-checkspelling-error-macro.html)

Bjorg P.

Application.CheckSpelling Error in Macro
 
Here is an extremely odd problem I am having...I am writing a macro and I need to write a function that will count the number of words not found in the dictionary for the text passed to the function. So, Application.CheckSpelling seems to be the way to go, but here is the problem - it doesn't work!

If I go to the immediate window and type ?Application.CheckSpelling("test", , False), it returns the correct result (True). Now, if I write this functio

Function Crazy(Text as String
Crazy = Application.CheckSpelling("test", , False
End Functio

and call it from a worksheet, it always returns False. It returns False for any word that you try to spell check. It is totally crazy that Application.CheckSpelling works in the immediate window in the VBA editor, but it doesn't work when you put it in a function in a macro and call that function from a cell. What am I doing wrong? Does anybody know how to correct this problem?

Dick Kusleika[_3_]

Application.CheckSpelling Error in Macro
 
Bjorg

I don't think you're doing anything wrong. I can confirm in XL2000 that it
doesn't work properly when called from a cell. I don't know of any way
around it, though.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Bjorg P." wrote in message
...
Here is an extremely odd problem I am having...I am writing a macro and I

need to write a function that will count the number of words not found in
the dictionary for the text passed to the function. So,
Application.CheckSpelling seems to be the way to go, but here is the
problem - it doesn't work!

If I go to the immediate window and type

?Application.CheckSpelling("test", , False), it returns the correct result
(True). Now, if I write this function

Function Crazy(Text as String)
Crazy = Application.CheckSpelling("test", , False)
End Function

and call it from a worksheet, it always returns False. It returns False

for any word that you try to spell check. It is totally crazy that
Application.CheckSpelling works in the immediate window in the VBA editor,
but it doesn't work when you put it in a function in a macro and call that
function from a cell. What am I doing wrong? Does anybody know how to
correct this problem?




All times are GMT +1. The time now is 08:12 PM.

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