I'm writing some Excel VBA code and I'm using the SortedList class from the MSCORLIB.DLL as documented by Microsoft: SortedList.Add (Object, Object). I'm getting a compile time error that I just don't understand:
Here's how I included MSCORLIB.DLL into my project:
Additionally, I have the Windows feature .NET Framework 3.5 turned on.
Why am I getting this compiler error?



Remove the parenthesis for subroutines that do not return a value.
Or if it does return a value, that's when you use parenthesis.
You may run into an Automation error in this case tho.
But at least it compiles, and that's what your question was about (VBA syntax).