If InStr(TitleFile, Title(iTeam)) > 0 Then (重复标题的处理...) Else TitleFile = TitleFile & vbCrLf & Title(iTeam) End If
[解决办法] 不是不准确吧。把你认为不准确的TitleFile, Title(iTeam)放出来看看…… [解决办法] Dim Title() As String Dim TitleFile As String
Private Sub Command1_Click() Dim i As Long Dim j As Long Dim MaxItem As Long Dim s As String Dim Temp() As String Dim MaxNew As Long
MaxItem = UBound(Title) ReDim Temp(MaxItem)
Temp(0) = Trim(Title(0))
For i = 1 To MaxItem s = Trim(Title(i)) If s <> "" Then For j = 0 To MaxNew If s = Trim(Title(j)) Then GoTo Found End If Next MaxNew = MaxNew + 1 Temp(MaxNew) = s End If Found: Next
ReDim Preserve Temp(MaxNew)
TitleFile = Join(Temp, vbCrLf) End Sub [解决办法] 注意中英文标点的区别,还有是否含回车符、换行符等等,还有instr比较方式等。 别把问题想成是程序函数的问题,多想想你自己的问题。