- 帖子
- 642
- 积分
- 1264
- 技术
- 1
- 捐助
- 0
- 注册时间
- 2012-7-1
|
11楼
发表于 2013-5-20 00:12
| 只看该作者
本帖最后由 思想之翼 于 2013-5-20 18:40 编辑
回复 5# tmplinshi
谢谢您的帮助!菜鸟的我还是感觉下面的VBS方便些,虽然是最笨的。
有个问题需要求教:这个VBS代码按列分解后,每个文本的数据最后(最底)留有一空行,导入excel运行宏时会报错,如何修改代码,就可以去除这一空行?
ar01 = Array(01)
ar02 = array(02)
ar03 = array(03)
ar04 = Array(04)
ar05 = array(05)
ar06 = array(06)
ar07 = Array(07)
ar08 = array(08)
ar09 = array(09)
ar10 = Array(10)
ar11 = array(11)
ar12 = array(12)
ar13 = Array(13)
ar14 = array(14)
ar15 = array(15)
ar16 = Array(16)
ar17 = array(17)
ar18 = array(18)
ar19 = Array(19)
ar20 = array(20)
ar21 = array(21)
ar22 = Array(22)
ar23 = array(23)
ar24 = array(24)
ar25 = Array(25)
ar26 = array(26)
ar27 = array(27)
ar28 = Array(28)
ar29 = array(29)
ar30 = array(30)
ar31 = Array(31)
ar32 = array(32)
ar33 = array(33)
ar34 = Array(34)
ar35 = array(35)
ar36 = array(36)
ar37 = Array(37)
ar38 = array(38)
ar39 = array(39)
ar40 = Array(40)
ar41 = array(41)
ar42 = array(42)
ar43 = Array(43)
ar44 = array(44)
ar45 = array(45)
ar46 = Array(46)
ar47 = array(47)
ar48 = array(48)
ar49 = Array(49)
ar50 = array(50)
ar51 = array(51)
ar52 = Array(52)
ar53 = array(53)
ar54 = array(54)
ar55 = Array(55)
ar56 = array(56)
ar57 = array(57)
ar58 = Array(58)
ar59 = array(59)
ar60 = array(60)
ar61 = Array(61)
ar62 = array(62)
ar63 = array(63)
Set FSO = CreateObject("Scripting.FileSystemObject")
getColumn ar01,"01.txt"
getColumn ar02,"02.txt"
getColumn ar03,"03.txt"
getColumn ar04,"04.txt"
getColumn ar05,"05.txt"
getColumn ar06,"06.txt"
getColumn ar07,"07.txt"
getColumn ar08,"08.txt"
getColumn ar09,"09.txt"
getColumn ar10,"10.txt"
getColumn ar11,"11.txt"
getColumn ar12,"12.txt"
getColumn ar13,"13.txt"
getColumn ar14,"14.txt"
getColumn ar15,"15.txt"
getColumn ar16,"16.txt"
getColumn ar17,"17.txt"
getColumn ar18,"18.txt"
getColumn ar19,"19.txt"
getColumn ar20,"20.txt"
getColumn ar21,"21.txt"
getColumn ar22,"22.txt"
getColumn ar23,"23.txt"
getColumn ar24,"24.txt"
getColumn ar25,"25.txt"
getColumn ar26,"26.txt"
getColumn ar27,"27.txt"
getColumn ar28,"28.txt"
getColumn ar29,"29.txt"
getColumn ar30,"30.txt"
getColumn ar31,"31.txt"
getColumn ar32,"32.txt"
getColumn ar33,"33.txt"
getColumn ar34,"34.txt"
getColumn ar35,"35.txt"
getColumn ar36,"36.txt"
getColumn ar37,"37.txt"
getColumn ar38,"38.txt"
getColumn ar39,"39.txt"
getColumn ar40,"40.txt"
getColumn ar41,"41.txt"
getColumn ar42,"42.txt"
getColumn ar43,"43.txt"
getColumn ar44,"44.txt"
getColumn ar45,"45.txt"
getColumn ar46,"46.txt"
getColumn ar47,"47.txt"
getColumn ar48,"48.txt"
getColumn ar49,"49.txt"
getColumn ar50,"50.txt"
getColumn ar51,"51.txt"
getColumn ar52,"52.txt"
getColumn ar53,"53.txt"
getColumn ar54,"54.txt"
getColumn ar55,"55.txt"
getColumn ar56,"56.txt"
getColumn ar57,"57.txt"
getColumn ar58,"58.txt"
getColumn ar59,"59.txt"
getColumn ar60,"60.txt"
getColumn ar61,"61.txt"
getColumn ar62,"62.txt"
getColumn ar63,"63.txt"
Sub getColumn(ar,filename)
Set file = FSO.OpenTextFile("a.txt",1)
Do While file.AtEndOfStream <> True
n = Split(file.ReadLine)
str = str & n(0)
For Each a In ar
str = str & " " & n(a)
Next
str = str & vbCrLf
Loop
file.Close
Set file = FSO.CreateTextFile(filename,True)
file.Write str
file.Close
End Sub |
|