Because os is english, and chinese lauguage isnt permited to install. I merely write this passage in english.
prepare:
I know data's perporty
1:every column's length
2:column's num
3:seperator is what
4:data's figure(num)
http://hiyachen.blog.chinaunix.net
chf@tsinghua.org.cn
real code below.
Private Sub CommandButton1_Click()
Dim txtLine As String * 1000
Dim ansitxtLine As String * 1000
Dim insStr As String
Dim outLn As String
Dim spera As String
'MsgBox "Start"
'read old data
oldcnt = Sheet1.Cells(5, 4)
fldcnt = Sheet1.Cells(7, 4)
outfile = Sheet1.Cells(6, 4)
spera = Sheet1.Cells(8, 4)
If spera = "chr(44)" Then
spera = ","
End If
'MsgBox "oldcnt=" & oldcnt & Chr(10) & _
"fldcnt=" & fldcnt & Chr(10) & _
"outFile=" & outfile
Open outfile For Output As #1
For i = 1 To oldcnt
'read line
txtLine = Sheet2.Cells(i, 1)
ansitxtLine = StrConv(txtLine, vbFromUnicode)
'read substr
For j = 1 To fldcnt
strsta = Sheet3.Cells(7 + j, 12)
strlen = Sheet3.Cells(7 + j, 16)
insStr = StrConv(MidB$(ansitxtLine, strsta, strlen), vbUnicode)
If j <> 1 Then
'outLn = outLn + ","
outLn = outLn + spera
End If
outLn = outLn + insStr
'MsgBox "insStr=" & insStr
insStr = ""
Next
Print #1, outLn
outLn = ""
'read substr
Next
Close
End Sub
阅读(3700) | 评论(0) | 转发(0) |