范本只附一个档案~但之后要扫将近4000个档案~
PowerPin()=>读入档案并处理过的资料
程序代码:Private Sub AAA()
.....
.....
For i = 0 To UBound(PowerPin)
Status = False
If i < UBound(PowerPin) Then
If GetDPS(CH_Data_Count).SameCount > 0 Then
CH_Data_Count = CH_Data_Count + 1
ReDim Preserve GetDPS(CH_Data_Count)
GetDPS(CH_Data_Count).SameCount = 0
ReDim GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount)
ReDim GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount)
End If
For j = i + 1 To UBound(PowerPin)
If PowerPin(i) <> "" Then
If PowerPin(j) <> "" Then
If GetName(0, PowerPin(i)) = GetName(0, PowerPin(j)) Then
If GetDPS(CH_Data_Count).DPin(0) = "" Then
GetDPS(CH_Data_Count).DPin(0) = GetName(1, PowerPin(i))
GetDPS(CH_Data_Count).Channel(0) = GetName(2, PowerPin(i))
GetDPS(CH_Data_Count).SameCount = GetDPS(CH_Data_Count).SameCount + 1
ReDim Preserve GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount)
GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) = GetName(1, PowerPin(j))
ReDim Preserve GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount)
GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) = GetName(2, PowerPin(j))
Else
GetDPS(CH_Data_Count).SameCount = GetDPS(CH_Data_Count).SameCount + 1
ReDim Preserve GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount)
GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) = GetName(1, PowerPin(j))
ReDim Preserve GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount)
GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) = GetName(2, PowerPin(j))
End If
Status = True: PowerPin(j) = ""
End If
End If
Else
Exit For
End If
Next j
End If
If Status = True Then
PowerPin(i) = ""
End If
Next i
Erase PowerPin
If GetDPS(CH_Data_Count).SameCount = 0 And GetDPS(CH_Data_Count).DPin(0) = "" And GetDPS(CH_Data_Count).Channel(0) = 0 Then
ReDim Preserve GetDPS(CH_Data_Count - 1)
End If
.......
.......
end Sub
Private Function GetName(Mode As Integer, PowerPin As String) As String
Dim Temp() As String, Temp1() As String
GetName = ""
Temp = Split(PowerPin, "=")
If Mode = 0 Then
If InStr(Temp(0), "_") <> 0 Then
Temp1 = Split(Temp(0), "_")
If IsNumeric(Temp1(UBound(Temp1))) = True Then
For k = 0 To (UBound(Temp1) - 1)
GetName = GetName & Temp1(k) & "_"
Next k
Else
For k = 0 To UBound(Temp1)
GetName = GetName & Temp1(k) & "_"
Next k
End If
GetName = Mid$(GetName, 1, Len(GetName) - 1)
Erase Temp1
Else
GetName = Temp(0)
End If
ElseIf Mode = 1 Then
GetName = Trim$(Temp(0))
ElseIf Mode = 2 Then
GetName = Trim$(Temp(1))
End If
Erase Temp
End Function








