版主,还是不行
我让sql选出来的赋值给a,用msgbox返回啊
If (Left(exlname, 1) = "3") Then
Dim a As Integer
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='excel 8.0;hdr=yes;imex=2';Data Source=" & mypath & arr(k) & "\" & exlname
Sql = "select 返还金额 from [回购数据$] where 基金名称='聚利基金'"
a = Sql
wb.Sheets(1).Cells(2, 5).CopyFromRecordset cnn.Execute(Sql)
cnn.Close
MsgBox (a)
End If