This little Excel VBA function always returns false, no what word is passed in.
Function SpellCheck(SomeWord As String)
SpellCheck = Application.CheckSpelli
While the bug in using the Excel Application object still exists, a UDF that requires it for the Application.CheckSpelling method can benefit from Early Binding and a Static variable declaration.
Function spellCheck(str As String) As Boolean
Static xlApp As New Excel.Application
spellCheck = xlApp.CheckSpelling(str)
End Function
The early binding speeds up the creation of the Excel.Application object. When used within Excel's VBA there is no need to use the CreateObject function as the reference library exists.
The Static variable declaration continues to exist in its assigned state after the function has been exited and is not recast on subsequent uses of the UDF. This makes situations like using the UDF to fill down a long column or as the determination formula in a conditional formatting rule more efficient.