By chance, I discovered that Excel doesn't warn you if you declare a variable with the same name as a built-in VBA function.
For example, the following compiles without errors:
But now, the "Day" function cannot be used. I get an error ("Expected array") with this code:
A Google search has revealed a workaround: use VBA.Day to invoke the function. But I would far rather that Excel warned me not to use Day as a variable name in the first place!
Is there a setting somewhere that prevents you from using built-in function names (such as Day, Date, Left, Right, etc.) as variable names?
Bluto
For example, the following compiles without errors:
Code:
Sub myProcedure
Dim Day As String
Day = "Monday"
End Sub
But now, the "Day" function cannot be used. I get an error ("Expected array") with this code:
Code:
Sub myProcedure
Dim Day As String
Day = "Monday"
Debug.Print Day("23,5,1980") [COLOR=#008000]'Offending line.[/COLOR]
End Sub
A Google search has revealed a workaround: use VBA.Day to invoke the function. But I would far rather that Excel warned me not to use Day as a variable name in the first place!
Is there a setting somewhere that prevents you from using built-in function names (such as Day, Date, Left, Right, etc.) as variable names?
Bluto