|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
Sub write_string_to_txt()
Dim sLine As String
Dim sFName As String
Dim iFNnumber As Integer
Dim lRow As Long
Const sVS As String = ","
Const sTD As String = """"
sFName = "F:\总账.txt"
iFNnumber = FreeFile
Open sFName For Output As #iFNnumber
lRow = 2
Do
sLine = Sheets("凭证").Cells(lRow, 1).Value & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 2).Value & sTD & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 3).Value & sTD & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 4).Value & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 5).Value & sTD & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 6).Value & sTD & sVS
sLine = sLine & Format(Sheets("凭证").Cells(lRow, 7).Value, "0.00") & sVS
sLine = sLine & Format(Sheets("凭证").Cells(lRow, 8).Value, "0.00") & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 9).Value & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 10).Value & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 11).Value & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 12).Value & sTD & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 13).Value & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 14).Value & sTD & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 15).Value & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 16).Value & sTD & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 17).Value & sTD & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 18).Value & sTD & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 19).Value & sTD & sVS
sLine = sLine & Sheets("凭证").Cells(lRow, 20).Value & sVS
sLine = sLine & sTD & Sheets("凭证").Cells(lRow, 21).Value & sTD & sVS
Print #iFNnumber, sLine
lRow = lRow + 1
Loop Until IsEmpty(Sheets("凭证").Cells(lRow, 1).Value)
Close #iFNnumber
End Sub
|
|