Application Worksheet Function
Warns about late-bound WorksheetFunction calls made against the extended interface of the Application object.
Reasoning
An early-bound, equivalent function exists in the object returned by the Application.WorksheetFunction property; late-bound member calls will fail at run-time with error 438 if there is a typo (a typo fails to compile for an early-bound member call); given invalid inputs, these late-bound member calls return a Variant/Error value that cannot be coerced into another type. The equivalent early-bound member calls raise a more VB-idiomatic, trappable runtime error given the same invalid inputs: trying to compare or assign a Variant/Error to another data type will throw error 13 "type mismatch" at run-time. A Variant/Error value cannot be coerced into any other data type, be it for assignment or comparison.
Default severity
Suggestion
Inspection type
CodeQualityIssues
This inspection will only run when the Excel library is referenced
Examples
This example should trigger a result
This example should NOT trigger a result
Rubberduck.CodeAnalysis.Inspections.Concrete.ApplicationWorksheetFunctionInspection.cs (Prerelease-v2.5.9.6289)