I get this error message after I try to run this script a second time, after a successful run the first time. Are there values still in the dictionary?
Error: This key is already associated with an element of this collection.
Code: 800A01C9
Main Part of Code Below....
Description: Will Compare a list of user ID's against one or two groups of user ID's (that are all stored in text files), and output a text file that contains the user ID's that were not part of either group list.
CODE (excerpt, if you want to see it all, let me know.)
Error: This key is already associated with an element of this collection.
Code: 800A01C9
Main Part of Code Below....
Description: Will Compare a list of user ID's against one or two groups of user ID's (that are all stored in text files), and output a text file that contains the user ID's that were not part of either group list.
CODE (excerpt, if you want to see it all, let me know.)
Code:
Set Dictionary1 = CreateObject("Scripting.Dictionary")
Set ReadFile = fso.OpenTextFile(MasterList1, 1, false)
Do While ReadFile.AtEndOfStream <> True
str1 = Trim(ReadFile.ReadLine())
Dictionary1.Add str1, True
Loop
ReadFile.close
Set ReadFile = fso.OpenTextFile(StringList, 1, false)
strArray = Split(ReadFile.ReadAll, vbCrLf)
For i = 0 to Ubound(strArray)
If Not Dictionary1.Exists (Trim(strArray(i))) Then
If fso.FileExists(OutputFile) Then
WriteFile.WriteLine strArray(i)
Else
Set WriteFile = fso.CreateTextFile(OutputFile, True)
WriteFile.WriteLine strArray(i)
End If
End If
Next