Const FOR_WRITING = 2
Dim objFso
Dim objOutputFile
Dim strOutputFile
Dim arrFirst
Dim arrSecond
Dim strElementFirst
Dim strElementSecond
Dim blnExistsInSecond
strOutputFile = "C:\temp\Differences.txt"
Set objFso = CreateObject("Scripting.FileSystemObject")
If objFso.FileExists(strOutputFile) Then
Set objOutputFile = objFso.OpenTextFile(strOutputFile,FOR_WRITING)
Else
Set objOutputFile = objFso.CreateTextFile(strOutputFile)
End If
arrFirst = arrFolders
arrSecond = Array("F","G","H","A","B","Z")
'the problem arises when the name of the element in arrFirst does not match the case of the element in arrSecond
For Each strElementFirst In arrFirst
blnExistsInSecond = False
For Each strElementSecond In arrSecond
If strElementFirst = strElementSecond Then
blnExistsInSecond = True
Exit For
End If
Next
If Not blnExistsInSecond Then
objOutputFile.WriteLine strElementFirst & " does not exist in the second array"
End If
Next
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.