 
- 帖子
- 766
- 积分
- 1457
- 技术
- 119
- 捐助
- 0
- 注册时间
- 2010-5-12
|
给个半成品。
Const Source = "D:\test.xls"
'Author: Demon
'Website: http://demon.tw
'Date: 2012/8/11
Set con = CreateObject("ADODB.Connection")
set rs1 = CreateObject("ADODB.Recordset")
set rs2 = CreateObject("ADODB.Recordset")
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.ConnectionString = "Data Source=" & Source &_
";Extended Properties=Excel 8.0;"
con.Open
rs1.Open "SELECT DISTINCT Name FROM `Sheet1$`", con
Do Until rs1.EOF
name = rs1.Fields("Name").Value
WScript.Echo name
rs2.Open "SELECT DISTINCT Num FROM `Sheet1$` WHERE Name = " & SingleQuoted(name), con
Do Until rs2.EOF
WScript.Echo rs2.Fields("Num").Value
rs2.MoveNext
Loop
rs2.Close
rs1.MoveNext
WScript.Echo ""
Loop
Function SingleQuoted(s)
SingleQuoted = "'" & s & "'"
End Function
|
-
1
评分人数
-
|