¤U±¬O§Ú¼g¨Ó±NtxtÀɸê®ÆÂনxlsÀÉ
¥i¬O§Ú§â¤U±¬õ¦âªº¦a¤è§ï¦¨xlsm®É´N·|¤£¯à¶]
·Q½Ð°Ý¸Ó«ç»ò§ï¤~¥i¥HÅܦ¨Âà´«xlsmÀÉ
ÁÂÁÂ~
Sub Main()
wk_name = ActiveWorkbook.Name
Application.Calculation = xlCalculationAutomatic '³]©w¦Û°Êpºâ
Windows(wk_name).Activate
Sheets("Main").Select
count910_num = Cells(1, 7) '°Ó«~Á`¼Æ
Cells(3, 2) = 1 '±q²Ä¤@Ó°Ó«~¶}©l¶]
For I = 1 To count910_num
Windows(wk_name).Activate
Sheets("Main").Select
Cells(3, 2) = I
intput_path910 = Cells(4, 3) '910Àɮצs©ñ¦ì§}
val_date = Cells(6, 3) 'µû»ù¤é
pol_name = Cells(7, 3) '°Ó«~¥N½X
Call openGR910 '¥s¥X¤U±ªºµ{¦¡
Next I
j = 1
Do
Windows(wk_name).Activate
Sheets("Main").Select
Cells(3, 2) = j
intput_path912 = Cells(5, 3) '912Àɮצs©ñ¦ì§}
val_date = Cells(6, 3)
pol_name = Cells(7, 3)
Call openGR912
j = j + 1
Loop While pol_name <> "64" '¥u¦³ºâ¨ì"64"³oÓÀIºØ¡A¦pªG¤§«áÁÙ¦³¼W¥[n¦A°µ×§ï
End Sub
Sub openGR910()
intput_path910 = Cells(4, 3)
intput_path912 = Cells(5, 3)
val_date = Cells(6, 3)
pol_name = Cells(7, 3)
'Ū¨úTXTÀɪº¼Æ¾Ú
ChDir intput_path910
Workbooks.OpenText Filename:=intput_path910 & "GR910_" & pol_name & "_" & val_date & ".txt", _
Origin:=950, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 2), Array(12, 2), Array(17, 2), Array(25, 2), Array(34, 2), Array(39, 2), Array(44 _
, 2), Array(55, 2), Array(72, 2), Array(77, 2), Array(84, 1), Array(97, 2), Array(106, 1), _
Array(117, 1), Array(129, 1), Array(144, 1)), TrailingMinusNumbers:=True
Cells.Select
Cells.EntireColumn.AutoFit
ActiveWindow.Zoom = 70
Range("A4").Select
ActiveWindow.FreezePanes = True
Application.DisplayAlerts = False '¤£nÅã¥ÜÃö³¬µøµ¡
'¦b¥H¤U¦ì§}¦s©ñÀÉ®×(ÀɦW.xls)
ActiveWorkbook.SaveAs Filename:=intput_path910 & "GR910_" & pol_name & ".xls" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close
End Sub
Sub openGR912()
Dim check_num As Long
intput_path910 = Cells(4, 3)
intput_path912 = Cells(5, 3)
val_date = Cells(6, 3)
pol_name = Cells(7, 3)
ChDir intput_path912
Workbooks.OpenText Filename:=intput_path912 & "GR912_" & pol_name & ".txt", _
Origin:=950, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
, Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 2), _
Array(9, 1), Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 2), Array(14, 1)), _
TrailingMinusNumbers:=True
Cells.Select
Cells.EntireColumn.AutoFit
ActiveWindow.Zoom = 80
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=intput_path912 & "GR912_" & pol_name & ".xls", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub |