If (ValidateServer(pcbDoc) = 1) Then
Dim Comps
Dim fso
Dim outFile
Dim myArray()
Dim j
Dim cellarray(), coordarray(), refdesarray()
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile(pcbDoc.Path & "LogFiles/Duplicated_cell.txt", True)
set Comps = pcbDoc.Components(epcbSelectAll, epcbCompAll, epcbCelltypeAll)
'msgbox "Comps.count = " & Comps.count
ReDim cellarray(Comps.count-1)
ReDim coordarray(Comps.count-1)
ReDim refdesarray(Comps.count-1)
For i = 1 to Comps.count
coordarray(i-1) = Comps.item(i).PartNumber & " " & Comps.item(i).CellName
'outFile.WriteLine coordarray(i-1)
Next
Call Sort(myArray)
Sub Sort( myArray )
Dim strHolder
For i = ( UBound( coordarray ) - 1 ) to 0 Step -1
For j= 0 to i
If UCase( coordarray( j ) ) > UCase( coordarray( j + 1 ) ) Then
strHolder = coordarray( j + 1 )
coordarray( j + 1 ) = coordarray( j )
coordarray( j ) = strHolder
End If
Next
Next
Dim MsgObj
For k = 0 to UBound( coordarray )
MsgObj = MsgObj & coordarray( k )& vbcrlf
Next
For i = 1 to Comps.count -1
For j = i to (i+1)
If Comps.item(i).PartNumber = Comps.item(j).PartNumber and Comps.item(i).CellName <> Comps.item(j).CellName Then
'outFile.WriteLine Comps.item(i).PartNumber & vbtab & Comps.item(j).CellName
End if
Next
Next
End Sub