本帖最后由 ggloverv 于 2010-02-25 12:13:19 编辑

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim s$(), ss$
    s = Split(Trim(Form1.Text2.Text), ",")
    For i = 0 To UBound(s)
        ss = Replace(Form1.Text1.Text, "," & s(i), "")
        ss = Replace(Form1.Text1.Text, s(i) & ",", "")
    Next i
    Form1.Text3.Text = ss
    End Sub
      

  2.   

    修改一下,哈哈。
    Private Sub Command1_Click()
    Dim s$(), ss$
    ss = Form1.Text1.Text
    s = Split(Trim(Form1.Text2.Text), ",")
    For i = 0 To UBound(s)
        ss = Replace(ss, "," & s(i), "")
        ss = Replace(ss, s(i) & ",", "")
    Next i
    Form1.Text3.Text = ss
    End Sub结果:
    13969563005,15269724228,13153955280,13326208876,13406589802
      

  3.   

    带输出,路径自己修改。
    Private Sub Command1_Click()
    Dim s$(), ss$
    ss = Form1.Text1.Text
    s = Split(Trim(Form1.Text2.Text), ",")
    For i = 0 To UBound(s)
        ss = Replace(ss, "," & s(i), "")
        ss = Replace(ss, s(i) & ",", "")
    Next i
    Open App.Path & "\3.txt" For Output As #1: Print #1, ss: Close #1
    End Sub
      

  4.   

    没什么难度吧!
    Option Explicit
    ' 把工程设置成从 Sub Main() 启动
    Sub Main()
        Dim strTextA$, strTextB$, strTemp$, i&, n%
        n = FreeFile()
        Open "X:\Temp\1.txt" For Binary As #n
        strTextA = Space$(LOF(n))
        Get #n, 1, strTextA
        Close
        Open "X:\Temp\2.txt" For Binary As #n
        strTextB = Space$(LOF(n))
        Get #n, 1, strTextB
        Close
        Open "X:\Temp\3.txt" For Output As #n
        For i = 1 To InStrRev(strTextA, ",") - 1 Step 12
            strTemp = Mid$(strTextA, i, 11)
            If (InStr(1, strTextB, strTemp) = 0) Then Print #n, strTemp
        Next
        Close
    End Sub
      

  5.   

    仅针对你在这里给出的文件格式:Private Sub Command1_Click()
       Open "c:\1.txt" For Input As #1
       Open "c:\2.txt" For Input As #2
       Open "c:\3.txt" For Output As #3
       Dim f1 As String, f2 As String
       Dim i As Integer, j As Integer
       Dim ff1() As String, ff2() As String
       
       Line Input #1, f1: f1 = Left(f1, Len(f1) - 1)
       Line Input #2, f2: f2 = Left(f2, Len(f2) - 1)
       ff1 = Split(f1, ","): ff2 = Split(f2, ",")
       For i = 0 To UBound(ff1)
           For j = 0 To UBound(ff2)
               If ff2(j) = ff1(i) Then ff1(i) = ""
               
       Next j, i
       For i = 0 To UBound(ff1)
           If ff1(i) <> "" Then Print #3, ff1(i) & ",";
       Next
       Close
       MsgBox "ok"
       
    End Sub
      

  6.   

    修改了一下,呵呵
    Private Sub Command1_Click()
    Dim s$(), s1$, s2$, ss$
    Open App.Path & "\1.txt" For Binary As #1: s1 = Trim(Input(LOF(1), #1)): Close #1
    Open App.Path & "\2.txt" For Binary As #1: s2 = Trim(Input(LOF(1), #1)): Close #1
    s = Split(Trim(s1), ",")
    For i = 0 To UBound(s)
        If 0 = InStr(s2, s(i)) Then ss = ss & s(i) & ","
    Next i
    Open App.Path & "\3.txt" For Output As #1: Print #1, ss: Close #1
    MsgBox "ok"
    End Sub
      

  7.   

    多谢skylinecn,你的也很符合我的要求,谢谢各位的努力,结贴了
      

  8.   

    虽然结贴了,我还是发一下,上面3楼代码出现的问题。主要是最后一个“,”分割出来的数组没有数据,然后在替换的时候照常替换了全部“,”,现修改一下,供楼主参考,互相学习一下。Private Sub Command1_Click()
    Dim s$(), s1$, s2$
    Open App.Path & "\1.txt" For Binary As #1: s1 = Trim(Input(LOF(1), #1)): Close #1
    Open App.Path & "\2.txt" For Binary As #1: s2 = Trim(Input(LOF(1), #1)): Close #1
    s = Split(Trim(s2), ",")
    For i = 0 To UBound(s)
        If Trim(s(i)) <> "" Then s1 = Replace(s1, "," & s(i), "")'加上判断是否为空数组避免替换所有“,”
        If Trim(s(i)) <> "" Then s1 = Replace(s1, s(i) & ",", "")
    Next i
    Open App.Path & "\3.txt" For Output As #1: Print #1, s1: Close #1
    MsgBox "ok"
    End Sub
      

  9.   


    把:Print #n, strTemp
    改成:Print #n, strTemp; ",";就是你要的输出格式了。