专注于自动化测试,性能测试.......
复制Excel某列数据到文本文件中
上一篇 /
下一篇 2009-04-01 00:51:24
/ 个人分类:Vbscript
bz/H%` \u0 51Testing软件测试网*d` @4?\eD$c
`+d+q0W-R7V0Set bjexcel = CreateObject("excel.application")
E$J
X,\!p}M0objexcel.Visible = True
-q/Y)pH.j0Set bjwork = objexcel.Workbooks.Open("d:\1.xls")
#V.Y9oP'Hgs3H-AW0Set bjsheet = objwork.worksheets(1)
(RboAgab0dV gs0'行
,J
d
y%eMnf0i=1
Pc
g.Z2d{(s;e0'列
3Q:K2Df$J G
R6k k0n=351Testing软件测试网Y~L6Bt)a$I$[I
Do While True51Testing软件测试网D$G%y;^%?}R+}l
strValue = objsheet.Cells(i,n)51Testing软件测试网F^nP$r$L2Pq
If strValue = "" Then51Testing软件测试网7@*X(N];h2E3q
Exit Do
X#lOa,s6e_?;W0 End If51Testing软件测试网`1I YPlR6u([
strText = strText & strValue & vbCrLf51Testing软件测试网`ka(vkL1rJXZ4h
i = i + 1
0ut.E(xR$kR0Loop
'H s x+hW p0
jE |Rn Oii VYK0objExcel.Quit
"v$r!?D$ytp0
51Testing软件测试网,i ?8@w SW D(@Set bjFSO = CreateObject("Scripting.FileSystemObject")51Testing软件测试网*~HMXs,i4a@
Set bjFile = objFSO.CreateTextFile("d:\ExcelData.txt")
&caiy-L&b0
51Testing软件测试网dc@h+x Q^eobjFile.Write strText