Probably* the easiest way is to add it on openning:
Private Sub Workbook_Open()
With ThisWorkbook.VBProject.References
.AddFromFile "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscorlib.tlb"
'.AddFromguid "{BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}", 2, 4
End With
End Sub
This adds the mscorlib.dll
to the references:
And then:
Public Sub TestMe()
Dim myList As SortedList
Dim myList2 As New ArrayList ' as a bonus!
End Sub
From http://www.snb-vba.eu/VBA_Sortedlist_en.html
- The SortedList is not an element of the regular VBA-library.
- The SortedList is part of the library System.Collections.
- You can find the library in
\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscorlib.tlb
or in a comparable directory
- In the VBEditor you can make a direct link to this library manually by checking mscorlib.dll in the References (Tools/references...)