VBS - Sorting a dictionary object
All of the examples that I found on the internet were WAY too complicated and hard to follow. Here is a very simple dictionary sort function that I figured I would share.
Function SortDict(ByVal objDict) 'Call using "Set objDictSorted = SortDict(objDict)" Dim i, j, temp For Each i In objDict For Each j In objDict If(objDict.Item(i) <= objDict.Item(j)) Then temp = objDict.Item(i) objDict.Item(i) = objDict.Item(j) objDict.Item(j) = temp End If Next Next 'For Each i In objDict ' WScript.Echo objDict.Item(i) 'Next Set SortDict = objDict End Function









