作者:乔山办公网日期:
返回目录:excel表格制作
xlApplication.Workbooks("打开的Excel文件名").sheets("要显示的工作表名字").Activate
Dim EApp As Object‘定义一知个全局道变量版
Private Sub CommandButton1_Click()'打开权
Set EApp = CreateObject("Excel.Application")
EApp.Visible = True
End Sub
Private Sub CommandButton2_Click()'关闭
If Not EApp Is Nothing Then
EApp.Quit
End If
End Sub
用ADO操作zd
Dim adoConnection As New ADODB.Connection
Dim adoRecordset As New ADODB.Recordset
Dim index As Integer
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;" & _
"Data Source=c:\book1.xls;Extended Properties='Excel 8.0;HDR=Yes'"
adoRecordset.Open "select * from [sheet1$]", adoConnection, adOpenKeyset, adLockOptimistic
类似如此,写个回循环,用游标获取答A1,相加
Excel.Application.Workbooks("CRM.xlsm").Activate