文本文档内容:Name = "EG"
Code = 0000434300003727438274827492832839 \
23782640000000我想把“ \”和回车符去掉,变成:Name = "EG"
Code = 000043430000372743827482749283283923782640000000不知怎样才能实现呢?

解决方案 »

  1.   

    直接把Code变换从Varaint类型的变量。
      

  2.   

    试试看,不保证对。
    f=freefile()
    s=""
    open "a.txt" for input as #f
    do
     Line input #f,ln
     if right(ln,2)=" \" then
      s=s+left(ln,len(ln)-2)
     else
      s=s+ln
      debug.printf s
      s=""
     endif
     if eof(f) then exit do
    loop
    close #f
      

  3.   

    Open App.Path & "\a.txt" For Input As #1
    Open App.Path & "\a_new.txt" For Output As #2Do Until EOF(1)
      Line Input #1, strTmp1
      If Right(strTmp1, 1) = "\" And Not EOF(1) Then
        Line Input #1, strTmp2
        strTmp1 = Left(strTmp1, Len(strTmp1) - 1) & strTmp2
      End If
      Print #2, strTmp1 
    LoopClose #2
    Close #1
    Kill App.Path & "\a.txt"
    Name App.Path & "\a_new.txt" As App.Path & "\a.txt"
      

  4.   

    s=".................."'包含有回车换行的字串s1=replace(s,vbcrlf,"") '将回车换行符号换为空字串
      

  5.   

    再去掉 "\"
    s1=replace(s,vbcrlf,"") '将回车换行符号换为空字串s1=replace(s1,"\","") 
      

  6.   

    replace(s,vbcr,"")
    replace(s,vblf,"")
      

  7.   

    replace(s,vbcr,"")
    replace(s,vblf,"")
    replace(s,"\","")
      

  8.   

    我做了一些小改動,試過可行~!謝謝~!Open App.Path & "\a.txt" For Input As #1
    Open App.Path & "\a_new.txt" For Output As #2Do
      Line Input #1, strTmp1
      If Right(strTmp1, 1) = "\" And Not EOF(1) Then
      Line Input #1, strTmp2
      strTmp1 = Left(strTmp1, Len(strTmp1) - 2) & strTmp2
      End If
      Print #2, strTmp1 
    Loop Until EOF(1)Close #2
    Close #1
    Kill App.Path & "\a.txt"
    Name App.Path & "\a_new.txt" As App.Path & "\a.txt"
      

  9.   

    額……上面的2Until EOF(1)
    本來是想標注修改的地方為紅色字體的,沒想到……
    去掉就好了。