Private Sub Command1_Click() Dim strTemp As String Dim strArrayFormat() As String Dim strArrayURL() As String Dim lngFormatMinCount As Long Dim lngFormatCount As Long Dim i As Long Dim j As Long Dim lngStart As Long Dim lngTemp As Long List1.Clear ' 先格式化过滤格式 strTemp = Text1.Text Do strTemp = Replace(strTemp,"**","*",vbTextCompare) Loop While InStr(1,strTemp,vbTextCompare) <> 0 Text1.Text = strTemp strTemp = UCase(strTemp) lngFormatMinCount = Len(strTemp) strArrayFormat = Split(strTemp,"*") lngFormatCount = UBound(strArrayFormat) strArrayURL = Split(Text2.Text,vbCrLf) For i = 0 To UBound(strArrayURL) lngStart = 1 If Len(strArrayURL(i)) >= lngFormatMinCount Then For j = 0 To lngFormatCount If j = 0 Then If Len(strArrayFormat(j)) > 0 Then If UCase(Left(strArrayURL(i),Len(strArrayFormat(j)))) <> strArrayFormat(j) Then GoTo NextUrlData End If Else '以 * 号开头的过滤格式 GoTo NextKey End If ElseIf j = lngFormatCount Then If Len(strArrayFormat(j)) > 0 Then If UCase(Right(strArrayURL(i),Len(strArrayFormat(j)))) <> strArrayFormat(j) Then GoTo NextUrlData End If Else '以 * 号结尾的过滤格式 End If List1.AddItem strArrayURL(i) Else lngTemp = InStr(lngStart,strArrayURL(i),strArrayFormat(j),vbTextCompare) If lngTemp = 0 Then GoTo NextUrlData End If lngStart = lngTemp + Len(strArrayFormat(j)) End If NextKey: Next j End If NextUrlData: Next i End Sub Private Sub Command2_Click() Dim i As Long Open "C:/Test.txt" For Output As #1 For i = 0 To List1.ListCount - 1 Print #1,List1.List(i) Next i Close #1 MsgBox "文件保存到 C:/Test.txt 里,确定到自动打开文本文件。",64,"提示" Shell "NOTEPAD.EXE C:/Test.txt",vbNormalFocus End Sub