|
Sub JK()
Dim SQL As String, MN%
Dim strconn As String
Dim CNN As Object, i&
Set CNN = CreateObject("ADODB.Connection")
MN = Month(Date)
CY = CDate(Date - 1)
With CNN
.Provider = "Microsoft.ACE.OLEDB.12.0; Extended Properties=Excel 12.0;Data Source="
CNN.Open strconn & ThisWorkbook.FullName
End With
Dim arr
sql1 = "SELECT 班级,ID FROM[维度$] where 评价='进步' "
sql3 = "SELECT TOP 4 [ID] FROM[维度$] order by [分数] desc "
sql2 = "SELECT 班级,ID FROM[维度$] where 评价='退步'"
arr = CNN.Execute(sql1).getRows
For i = 0 To UBound(arr, 2)
strResult = strResult & arr(0, i) & arr(1, i) & ", " '
Next
arr = CNN.Execute(sql3).getRows
strResult = strResult & vbLf
For i = 0 To UBound(arr, 2)
strResult = strResult & arr(0, i) & ","
Next
arr = CNN.Execute(sql2).getRows
strResult = strResult & vbLf
For i = 0 To UBound(arr, 2)
strResult = strResult & arr(0, i) & arr(1, i) & ", "
Next
strResult = Left(strResult, Len(strResult) - 1)
[A10].Value = strResult
Set CNN = Nothing
Set rs1 = Nothing
End Sub
|
评分
-
1
查看全部评分
-
|