文本读写问题,急
用读取文本文件,再写入另一个文本文件时出错了。
原程序如下:
Dim s1 As String, ls_Content1() As String
Open App.Path & "\xml\userquery.txt" For Input As #1
s1 = StrConv(InputB(LOF(1), #1), vbUnicode) '将文件内容附给变量 S
Close #1
ls_Content1 = Split(s1, vbCrLf) '将每一行的信息放入数组
lx_max1 = UBound(ls_Content1)
tabl = ls_Content1(1)
Text1 = ls_Content1(2)
Text2 = ls_Content1(3)
Open App.Path & "\xml\c.xml" For Append As #1 '追加
For i = 4 To lx_max1
Print #1, ls_Content1(i) '第五行
Next i
Close #1
要写入的文本
<Cell Row="1" Col="1" >10000001</Cell>
<Cell Row="1" Col="2" >直播</Cell>
<Cell Row="1" Col="3" >胡萝卜</Cell>
<Cell Row="1" Col="4" >入场</Cell>
<Cell Row="1" Col="5" >05146436000</Cell>
<Cell Row="1" Col="6" >纱胡作</Cell>
<Cell Row="1" Col="7" >2005-06-22 12:00:00.0</Cell>
</Cells>
结果变成了
<Cell Row="1" Col="1" >10000001</Cell>
<Cell Row="1" Col="2" >鐩存挱</Cell>
<Cell Row="1" Col="3" >鑳¤悵鍗?/Cell>
<Cell Row="1" Col="4" >鍏ュ満</Cell>
<Cell Row="1" Col="5" >05146436000</Cell>
<Cell Row="1" Col="6" >绾辫儭浣?/Cell>
<Cell Row="1" Col="7" >2005-06-22 12:00:00.0</Cell>
</Cells>
请问为何
但当文字为三个汉字时正常