vb
Const strFileStartName As String = "僺僢僉儞僌PL嶌嬈奐巒"
Const strFileEndName As String = "僺僢僉儞僌PL嶌嬈姰椆"
Const strFileDumyEndName As String = "僟儈乕儘働乕僔儑儞擖屔姰椆"
Const strFilePartEndName As String = "僺僢僉儞僌PL嶌嬈姰椆乮堦晹乯"
Const strFileNoDataEndName As String = "僺僢僉儞僌PL嶌嬈姰椆乮柧嵶側偟乯"
Const strSheetNameOutPutFileType As String = "OutPutFileType"
Const strUser As String = "DEFILER"
Const strFilePaht As String = "D:\ReportDefines\"
Sub main()
Dim strOutPutFileName As String
Dim strType As String
Dim iLen As Integer
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僼傽僀儖撉傒崬傓
'''''''''''''''''''''''''''''''''''''''''''''''''''
Dim theSh As Variant
theSh = Application.GetOpenFilename("Csv Files (*.csv), *.csv", , , , True)
If VarType(theSh) = vbBoolean Then
Exit Sub
Else
For i = 1 To UBound(theSh)
Call makeFiles(CStr(theSh(i)))
' MsgBox theSh(i)
Next
End If
End Sub
Function makeFiles(filePath As String)
Dim fileName As String
Dim tempV As Variant
Dim tempStr As String
tempV = Split(filePath, "\")
fileName = tempV(UBound(tempV))
fileName = Left(fileName, Len(fileName) - 4)
Dim strLine As String
Open filePath For Input As #2
Line Input #2, strLine
Close #2
Debug.Print strLine
tempV = Split(strLine, ",")
tempStr = tempV(2)
Debug.Print tempStr
tempStr = VBA.Replace(tempStr, """", "")
Dim str揱昜擭寧擔 As String
Dim str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO As String
Dim str僺僢僉儞僌廤栺No_捠斣 As String
Dim strStartTime As String
str揱昜擭寧擔 = Mid(tempStr, 7, 8)
str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO = Mid(tempStr, 15, 7)
str僺僢僉儞僌廤栺No_捠斣 = Mid(tempStr, 23, 2)
strStartTime = Format(Now(), "YYYYMMDDHHMMSS")
Dim strOutput As String
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈奐巒 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileStartName & ".txt"
Open strOutPutFileName For Output As #1
strOutput = ""
'揹暥ID
strOutput = strOutput & "PS"
'揱昜擭寧擔
strOutput = strOutput & str揱昜擭寧擔
'僺僢僉儞僌廤栺俶倧_僌儖乕僺儞僌NO
strOutput = strOutput & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
'僺僢僉儞僌廤栺俶倧_巬斣
strOutput = strOutput & "0"
'僺僢僉儞僌廤栺俶倧_捠斣
strOutput = strOutput & str僺僢僉儞僌廤栺No_捠斣
'嶌嬈幰僐乕僪
strOutput = strOutput & strUser
'嶌嬈奐巒擔帪
strOutput = strOutput & strStartTime
Print #1, "PS" & str揱昜擭寧擔 & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO & "0" & str僺僢僉儞僌廤栺No_捠斣 _
& strUser & strStartTime
Close #1
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僟儈乕儘働乕僔儑儞擖屔姰椆 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileDumyEndName & ".txt"
Open strOutPutFileName For Output As #1
strOutput = ""
'揹暥ID
strOutput = strOutput & "WA"
'嶌嬈ID
strOutput = strOutput & doAddValueType("", "X", 4)
'嶌嬈幰僐乕僪
strOutput = strOutput & strUser
'嶌嬈奐巒擔帪
strOutput = strOutput & strStartTime
'嶌嬈姰椆擔帪
strOutput = strOutput & getEndTime()
'媥宔帪娫(椵愊)
strOutput = strOutput & doAddValueType("1", "9", 3)
''''僶乕僐乕僪忣曬
'揱昜擭寧擔
strOutput = strOutput & str揱昜擭寧擔
'僺僢僉儞僌廤栺俶倧_僌儖乕僺儞僌NO
strOutput = strOutput & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
'僺僢僉儞僌廤栺俶倧_捠斣
strOutput = strOutput & str僺僢僉儞僌廤栺No_捠斣
'俥倝倢倢倕倰
strOutput = strOutput & doAddValueType("", "X", 22)
Print #1, strOutput
Close #1
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈姰椆 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutput = ""
'揹暥ID
strOutput = strOutput & "PE"
'揱昜擭寧擔
strOutput = strOutput & str揱昜擭寧擔
'僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
strOutput = strOutput & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
'僺僢僉儞僌廤栺No_巬斣
strOutput = strOutput & "0"
'僺僢僉儞僌廤栺No_捠斣
strOutput = strOutput & str僺僢僉儞僌廤栺No_捠斣
'嶌嬈ID
strOutput = strOutput & doAddValueType("", "X", 4)
'嶌嬈幰僐乕僪
strOutput = strOutput & strUser
'嶌嬈奐巒擔帪
strOutput = strOutput & strStartTime
'嶌嬈姰椆擔帪
strOutput = strOutput & getEndTime()
'媥宔帪娫(椵愊)
strOutput = strOutput & doAddValueType("1", "9", 3)
'TODO
'傾儔乕儉 (撉傒庢傝僄儔乕夞悢)
strOutput = strOutput & doAddValueType("", "9", 2)
'傾儔乕儉 (廳検専昳僄儔乕悢)
strOutput = strOutput & doAddValueType("", "9", 2)
'傾儔乕儉 (攳偓庢傝桳柍)
strOutput = strOutput & doAddValueType("", "9", 1)
'傾儔乕儉 (QR儔儀儖報帤帪娫)
strOutput = strOutput & doAddValueType("", "9", 4)
'傾儔乕儉 (梊旛)
strOutput = strOutput & doAddValueType("", "9", 10)
'壼懙偊愭儘働乕僔儑儞
strOutput = strOutput & doAddValueType("", "X", 10)
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈姰椆乮暘妱僨乕僞側偟乯 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileNoDataEndName & ".txt"
Open strOutPutFileName For Output As #1
Print #1, strOutput
Close #1
'
Dim strOutput2 As String
strOutput2 = strOutput
Dim tempValue As String
Dim str庬暿 As String
Dim str儘働乕僔儑儞僐乕僪 As String
Dim str妋擣嬫暘 As String
Dim str彜昳僐乕僪 As String
Dim str暔棳斈梡僐乕僪 As String
Dim str曪憰僐乕僪 As String
Dim str堷偒摉偰擔_QR梡曄姺幚巤 As String
Dim str弌壼僷儗僢僩悢 As String
Dim str抂悢働乕僗悢 As String
Dim str僶儔悢 As String
Dim str弌壼嬫暘 As String
Dim str弌壼応強 As String
Dim str巜帵堘偄昳嬫暘 As String
Dim dI As Integer
dI = 0
For i = 0 To 9
tempValue = Mid(tempStr, 51 + 81 * i, 81)
dI = dI + CharacterLen(tempValue) - 81
If Trim(tempValue) = "" Then
GoTo endFor
End If
'庬暿 1
str庬暿 = Mid(tempValue, 1, 1)
'儘働乕僔儑儞僐乕僪 10
str儘働乕僔儑儞僐乕僪 = Mid(tempValue, 2, 10)
'妋擣嬫暘 1
str妋擣嬫暘 = Mid(tempValue, 12, 1)
'彜昳僐乕僪 6
str彜昳僐乕僪 = Mid(tempValue, 15, 6)
'慡妏KILL
tempValue = Right(tempValue, 29 + dI)
'暔棳斈梡僐乕僪 4
str暔棳斈梡僐乕僪 = Mid(tempValue, 1, 4)
'曪憰僐乕僪 6
str曪憰僐乕僪 = Mid(tempValue, 5, 6)
'堷偒摉偰擔 (QR梡曄姺幚巤) 3
str堷偒摉偰擔_QR梡曄姺幚巤 = Mid(tempValue, 11, 3)
'弌壼僷儗僢僩悢 3
str弌壼僷儗僢僩悢 = Mid(tempValue, 14, 3)
str弌壼僷儗僢僩悢2 = makeLess(str弌壼僷儗僢僩悢, 3)
'抂悢働乕僗悢 3
str抂悢働乕僗悢 = Mid(tempValue, 20, 3)
str抂悢働乕僗悢2 = makeLess(str抂悢働乕僗悢, 3)
'僶儔悢 2
str僶儔悢 = Mid(tempValue, 23, 2)
str僶儔悢2 = makeLess(str僶儔悢, 2)
'弌壼嬫暘 2
str弌壼嬫暘 = Mid(tempValue, 25, 1)
'弌壼応強 4
str弌壼応強 = Mid(tempValue, 26, 4)
'巜帵堘偄昳嬫暘 1
str巜帵堘偄昳嬫暘 = "0"
'庬暿
strOutput = strOutput & str庬暿
'儘働乕僔儑儞僐乕僪
strOutput = strOutput & str儘働乕僔儑儞僐乕僪
'妋擣嬫暘
strOutput = strOutput & str妋擣嬫暘
'彜昳僐乕僪
strOutput = strOutput & str彜昳僐乕僪
'暔棳斈梡僐乕僪
strOutput = strOutput & str暔棳斈梡僐乕僪
'曪憰僐乕僪
strOutput = strOutput & str曪憰僐乕僪
'堷偒摉偰擔 (QR梡曄姺幚巤)
strOutput = strOutput & str堷偒摉偰擔_QR梡曄姺幚巤
'弌壼僷儗僢僩悢
strOutput = strOutput & str弌壼僷儗僢僩悢
'抂悢働乕僗悢
strOutput = strOutput & str抂悢働乕僗悢
'僶儔悢
strOutput = strOutput & str僶儔悢
'弌壼嬫暘
strOutput = strOutput & str弌壼嬫暘
'弌壼応強
strOutput = strOutput & str弌壼応強
'巜帵堘偄昳嬫暘
strOutput = strOutput & str巜帵堘偄昳嬫暘
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'庬暿
strOutput2 = strOutput2 & str庬暿
'儘働乕僔儑儞僐乕僪
strOutput2 = strOutput2 & str儘働乕僔儑儞僐乕僪
'妋擣嬫暘
strOutput2 = strOutput2 & str妋擣嬫暘
'彜昳僐乕僪
strOutput2 = strOutput2 & str彜昳僐乕僪
'暔棳斈梡僐乕僪
strOutput2 = strOutput2 & str暔棳斈梡僐乕僪
'曪憰僐乕僪
strOutput2 = strOutput2 & str曪憰僐乕僪
'堷偒摉偰擔 (QR梡曄姺幚巤)
strOutput2 = strOutput2 & str堷偒摉偰擔_QR梡曄姺幚巤
'弌壼僷儗僢僩悢
strOutput2 = strOutput2 & str弌壼僷儗僢僩悢2
'抂悢働乕僗悢
strOutput2 = strOutput2 & str抂悢働乕僗悢2
'僶儔悢
strOutput2 = strOutput2 & str僶儔悢2
'弌壼嬫暘
strOutput2 = strOutput2 & str弌壼嬫暘
'弌壼応強
strOutput2 = strOutput2 & str弌壼応強
'巜帵堘偄昳嬫暘
strOutput2 = strOutput2 & str巜帵堘偄昳嬫暘
Next
endFor:
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈姰椆乮暘妱僨乕僞娷傓乯 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileEndName & ".txt"
Open strOutPutFileName For Output As #1
Print #1, strOutput
Close #1
'''''''''''''''''''''''''''''''''''''''''''''''''''
'僺僢僉儞僌PL嶌嬈姰椆乮堦晹乯 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFilePartEndName & ".txt"
Open strOutPutFileName For Output As #1
Print #1, strOutput2
Close #1
End Function
''''''''''''''''''''''''''''''''''''''''''
'悢帤偺応崌丄愭摢偵乽0乿傪捛壛偡傞
'暥帤偺応崌丄屻傠偵僗儁僢僗傪捛壛偡傞
''''''''''''''''''''''''''''''''''''''''''
Function doAddValueType(strValue As String, strType As String, iLen As Integer)
Dim result As String
result = strValue
For i = 1 To iLen
'悢帤偺応崌丄愭摢偵乽0乿傪捛壛偡傞
If strType = "9" Then
result = "0" & result
'暥帤偺応崌丄屻傠偵僗儁僢僗傪捛壛偡傞
Else
result = result & " "
End If
Next
'悢帤偺応崌丄愭摢偵乽0乿傪捛壛偡傞
If strType = "9" Then
result = Right(result, iLen)
'暥帤偺応崌丄屻傠偵僗儁僢僗傪捛壛偡傞
Else
result = Left(result, iLen)
End If
doAddValueType = result
End Function
Function getEndTime()
getEndTime = Format(Now(), "YYYYMMDD") & "235959"
End Function
Sub test()
Debug.Print Format(Now(), "YYYYMMDDHHMMSS")
End Sub
Function CharacterLen(s_str As String) As Integer
Dim i_num As Integer
Dim i_index As Integer
Dim i_len As Integer
i_len = Len(s_str)
For i_index = 1 To i_len
If Asc(Mid(s_str, i_index, 1)) < 0 Then
i_num = i_num + 1
End If
Next
CharacterLen = i_len + i_num
End Function
Function makeLess(numberString As String, iLen As Integer)
Dim result As String
If CInt(numberString) > 1 Then
result = CStr(CInt(numberString) - 1)
Else
result = numberString
End If
makeLess = doAddValueType(result, "9", iLen)
End Function
Const strFileEndName As String = "僺僢僉儞僌PL嶌嬈姰椆"
Const strFileDumyEndName As String = "僟儈乕儘働乕僔儑儞擖屔姰椆"
Const strFilePartEndName As String = "僺僢僉儞僌PL嶌嬈姰椆乮堦晹乯"
Const strFileNoDataEndName As String = "僺僢僉儞僌PL嶌嬈姰椆乮柧嵶側偟乯"
Const strSheetNameOutPutFileType As String = "OutPutFileType"
Const strUser As String = "DEFILER"
Const strFilePaht As String = "D:\ReportDefines\"
Sub main()
Dim strOutPutFileName As String
Dim strType As String
Dim iLen As Integer
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僼傽僀儖撉傒崬傓
'''''''''''''''''''''''''''''''''''''''''''''''''''
Dim theSh As Variant
theSh = Application.GetOpenFilename("Csv Files (*.csv), *.csv", , , , True)
If VarType(theSh) = vbBoolean Then
Exit Sub
Else
For i = 1 To UBound(theSh)
Call makeFiles(CStr(theSh(i)))
' MsgBox theSh(i)
Next
End If
End Sub
Function makeFiles(filePath As String)
Dim fileName As String
Dim tempV As Variant
Dim tempStr As String
tempV = Split(filePath, "\")
fileName = tempV(UBound(tempV))
fileName = Left(fileName, Len(fileName) - 4)
Dim strLine As String
Open filePath For Input As #2
Line Input #2, strLine
Close #2
Debug.Print strLine
tempV = Split(strLine, ",")
tempStr = tempV(2)
Debug.Print tempStr
tempStr = VBA.Replace(tempStr, """", "")
Dim str揱昜擭寧擔 As String
Dim str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO As String
Dim str僺僢僉儞僌廤栺No_捠斣 As String
Dim strStartTime As String
str揱昜擭寧擔 = Mid(tempStr, 7, 8)
str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO = Mid(tempStr, 15, 7)
str僺僢僉儞僌廤栺No_捠斣 = Mid(tempStr, 23, 2)
strStartTime = Format(Now(), "YYYYMMDDHHMMSS")
Dim strOutput As String
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈奐巒 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileStartName & ".txt"
Open strOutPutFileName For Output As #1
strOutput = ""
'揹暥ID
strOutput = strOutput & "PS"
'揱昜擭寧擔
strOutput = strOutput & str揱昜擭寧擔
'僺僢僉儞僌廤栺俶倧_僌儖乕僺儞僌NO
strOutput = strOutput & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
'僺僢僉儞僌廤栺俶倧_巬斣
strOutput = strOutput & "0"
'僺僢僉儞僌廤栺俶倧_捠斣
strOutput = strOutput & str僺僢僉儞僌廤栺No_捠斣
'嶌嬈幰僐乕僪
strOutput = strOutput & strUser
'嶌嬈奐巒擔帪
strOutput = strOutput & strStartTime
Print #1, "PS" & str揱昜擭寧擔 & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO & "0" & str僺僢僉儞僌廤栺No_捠斣 _
& strUser & strStartTime
Close #1
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僟儈乕儘働乕僔儑儞擖屔姰椆 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileDumyEndName & ".txt"
Open strOutPutFileName For Output As #1
strOutput = ""
'揹暥ID
strOutput = strOutput & "WA"
'嶌嬈ID
strOutput = strOutput & doAddValueType("", "X", 4)
'嶌嬈幰僐乕僪
strOutput = strOutput & strUser
'嶌嬈奐巒擔帪
strOutput = strOutput & strStartTime
'嶌嬈姰椆擔帪
strOutput = strOutput & getEndTime()
'媥宔帪娫(椵愊)
strOutput = strOutput & doAddValueType("1", "9", 3)
''''僶乕僐乕僪忣曬
'揱昜擭寧擔
strOutput = strOutput & str揱昜擭寧擔
'僺僢僉儞僌廤栺俶倧_僌儖乕僺儞僌NO
strOutput = strOutput & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
'僺僢僉儞僌廤栺俶倧_捠斣
strOutput = strOutput & str僺僢僉儞僌廤栺No_捠斣
'俥倝倢倢倕倰
strOutput = strOutput & doAddValueType("", "X", 22)
Print #1, strOutput
Close #1
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈姰椆 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutput = ""
'揹暥ID
strOutput = strOutput & "PE"
'揱昜擭寧擔
strOutput = strOutput & str揱昜擭寧擔
'僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
strOutput = strOutput & str僺僢僉儞僌廤栺No_僌儖乕僺儞僌NO
'僺僢僉儞僌廤栺No_巬斣
strOutput = strOutput & "0"
'僺僢僉儞僌廤栺No_捠斣
strOutput = strOutput & str僺僢僉儞僌廤栺No_捠斣
'嶌嬈ID
strOutput = strOutput & doAddValueType("", "X", 4)
'嶌嬈幰僐乕僪
strOutput = strOutput & strUser
'嶌嬈奐巒擔帪
strOutput = strOutput & strStartTime
'嶌嬈姰椆擔帪
strOutput = strOutput & getEndTime()
'媥宔帪娫(椵愊)
strOutput = strOutput & doAddValueType("1", "9", 3)
'TODO
'傾儔乕儉 (撉傒庢傝僄儔乕夞悢)
strOutput = strOutput & doAddValueType("", "9", 2)
'傾儔乕儉 (廳検専昳僄儔乕悢)
strOutput = strOutput & doAddValueType("", "9", 2)
'傾儔乕儉 (攳偓庢傝桳柍)
strOutput = strOutput & doAddValueType("", "9", 1)
'傾儔乕儉 (QR儔儀儖報帤帪娫)
strOutput = strOutput & doAddValueType("", "9", 4)
'傾儔乕儉 (梊旛)
strOutput = strOutput & doAddValueType("", "9", 10)
'壼懙偊愭儘働乕僔儑儞
strOutput = strOutput & doAddValueType("", "X", 10)
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈姰椆乮暘妱僨乕僞側偟乯 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileNoDataEndName & ".txt"
Open strOutPutFileName For Output As #1
Print #1, strOutput
Close #1
'
Dim strOutput2 As String
strOutput2 = strOutput
Dim tempValue As String
Dim str庬暿 As String
Dim str儘働乕僔儑儞僐乕僪 As String
Dim str妋擣嬫暘 As String
Dim str彜昳僐乕僪 As String
Dim str暔棳斈梡僐乕僪 As String
Dim str曪憰僐乕僪 As String
Dim str堷偒摉偰擔_QR梡曄姺幚巤 As String
Dim str弌壼僷儗僢僩悢 As String
Dim str抂悢働乕僗悢 As String
Dim str僶儔悢 As String
Dim str弌壼嬫暘 As String
Dim str弌壼応強 As String
Dim str巜帵堘偄昳嬫暘 As String
Dim dI As Integer
dI = 0
For i = 0 To 9
tempValue = Mid(tempStr, 51 + 81 * i, 81)
dI = dI + CharacterLen(tempValue) - 81
If Trim(tempValue) = "" Then
GoTo endFor
End If
'庬暿 1
str庬暿 = Mid(tempValue, 1, 1)
'儘働乕僔儑儞僐乕僪 10
str儘働乕僔儑儞僐乕僪 = Mid(tempValue, 2, 10)
'妋擣嬫暘 1
str妋擣嬫暘 = Mid(tempValue, 12, 1)
'彜昳僐乕僪 6
str彜昳僐乕僪 = Mid(tempValue, 15, 6)
'慡妏KILL
tempValue = Right(tempValue, 29 + dI)
'暔棳斈梡僐乕僪 4
str暔棳斈梡僐乕僪 = Mid(tempValue, 1, 4)
'曪憰僐乕僪 6
str曪憰僐乕僪 = Mid(tempValue, 5, 6)
'堷偒摉偰擔 (QR梡曄姺幚巤) 3
str堷偒摉偰擔_QR梡曄姺幚巤 = Mid(tempValue, 11, 3)
'弌壼僷儗僢僩悢 3
str弌壼僷儗僢僩悢 = Mid(tempValue, 14, 3)
str弌壼僷儗僢僩悢2 = makeLess(str弌壼僷儗僢僩悢, 3)
'抂悢働乕僗悢 3
str抂悢働乕僗悢 = Mid(tempValue, 20, 3)
str抂悢働乕僗悢2 = makeLess(str抂悢働乕僗悢, 3)
'僶儔悢 2
str僶儔悢 = Mid(tempValue, 23, 2)
str僶儔悢2 = makeLess(str僶儔悢, 2)
'弌壼嬫暘 2
str弌壼嬫暘 = Mid(tempValue, 25, 1)
'弌壼応強 4
str弌壼応強 = Mid(tempValue, 26, 4)
'巜帵堘偄昳嬫暘 1
str巜帵堘偄昳嬫暘 = "0"
'庬暿
strOutput = strOutput & str庬暿
'儘働乕僔儑儞僐乕僪
strOutput = strOutput & str儘働乕僔儑儞僐乕僪
'妋擣嬫暘
strOutput = strOutput & str妋擣嬫暘
'彜昳僐乕僪
strOutput = strOutput & str彜昳僐乕僪
'暔棳斈梡僐乕僪
strOutput = strOutput & str暔棳斈梡僐乕僪
'曪憰僐乕僪
strOutput = strOutput & str曪憰僐乕僪
'堷偒摉偰擔 (QR梡曄姺幚巤)
strOutput = strOutput & str堷偒摉偰擔_QR梡曄姺幚巤
'弌壼僷儗僢僩悢
strOutput = strOutput & str弌壼僷儗僢僩悢
'抂悢働乕僗悢
strOutput = strOutput & str抂悢働乕僗悢
'僶儔悢
strOutput = strOutput & str僶儔悢
'弌壼嬫暘
strOutput = strOutput & str弌壼嬫暘
'弌壼応強
strOutput = strOutput & str弌壼応強
'巜帵堘偄昳嬫暘
strOutput = strOutput & str巜帵堘偄昳嬫暘
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'庬暿
strOutput2 = strOutput2 & str庬暿
'儘働乕僔儑儞僐乕僪
strOutput2 = strOutput2 & str儘働乕僔儑儞僐乕僪
'妋擣嬫暘
strOutput2 = strOutput2 & str妋擣嬫暘
'彜昳僐乕僪
strOutput2 = strOutput2 & str彜昳僐乕僪
'暔棳斈梡僐乕僪
strOutput2 = strOutput2 & str暔棳斈梡僐乕僪
'曪憰僐乕僪
strOutput2 = strOutput2 & str曪憰僐乕僪
'堷偒摉偰擔 (QR梡曄姺幚巤)
strOutput2 = strOutput2 & str堷偒摉偰擔_QR梡曄姺幚巤
'弌壼僷儗僢僩悢
strOutput2 = strOutput2 & str弌壼僷儗僢僩悢2
'抂悢働乕僗悢
strOutput2 = strOutput2 & str抂悢働乕僗悢2
'僶儔悢
strOutput2 = strOutput2 & str僶儔悢2
'弌壼嬫暘
strOutput2 = strOutput2 & str弌壼嬫暘
'弌壼応強
strOutput2 = strOutput2 & str弌壼応強
'巜帵堘偄昳嬫暘
strOutput2 = strOutput2 & str巜帵堘偄昳嬫暘
Next
endFor:
'''''''''''''''''''''''''''''''''''''''''''''''''''
' 僺僢僉儞僌PL嶌嬈姰椆乮暘妱僨乕僞娷傓乯 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFileEndName & ".txt"
Open strOutPutFileName For Output As #1
Print #1, strOutput
Close #1
'''''''''''''''''''''''''''''''''''''''''''''''''''
'僺僢僉儞僌PL嶌嬈姰椆乮堦晹乯 僼傽僀儖嶌惉
'''''''''''''''''''''''''''''''''''''''''''''''''''
strOutPutFileName = ThisWorkbook.Path & "\" & fileName & strFilePartEndName & ".txt"
Open strOutPutFileName For Output As #1
Print #1, strOutput2
Close #1
End Function
''''''''''''''''''''''''''''''''''''''''''
'悢帤偺応崌丄愭摢偵乽0乿傪捛壛偡傞
'暥帤偺応崌丄屻傠偵僗儁僢僗傪捛壛偡傞
''''''''''''''''''''''''''''''''''''''''''
Function doAddValueType(strValue As String, strType As String, iLen As Integer)
Dim result As String
result = strValue
For i = 1 To iLen
'悢帤偺応崌丄愭摢偵乽0乿傪捛壛偡傞
If strType = "9" Then
result = "0" & result
'暥帤偺応崌丄屻傠偵僗儁僢僗傪捛壛偡傞
Else
result = result & " "
End If
Next
'悢帤偺応崌丄愭摢偵乽0乿傪捛壛偡傞
If strType = "9" Then
result = Right(result, iLen)
'暥帤偺応崌丄屻傠偵僗儁僢僗傪捛壛偡傞
Else
result = Left(result, iLen)
End If
doAddValueType = result
End Function
Function getEndTime()
getEndTime = Format(Now(), "YYYYMMDD") & "235959"
End Function
Sub test()
Debug.Print Format(Now(), "YYYYMMDDHHMMSS")
End Sub
Function CharacterLen(s_str As String) As Integer
Dim i_num As Integer
Dim i_index As Integer
Dim i_len As Integer
i_len = Len(s_str)
For i_index = 1 To i_len
If Asc(Mid(s_str, i_index, 1)) < 0 Then
i_num = i_num + 1
End If
Next
CharacterLen = i_len + i_num
End Function
Function makeLess(numberString As String, iLen As Integer)
Dim result As String
If CInt(numberString) > 1 Then
result = CStr(CInt(numberString) - 1)
Else
result = numberString
End If
makeLess = doAddValueType(result, "9", iLen)
End Function
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.