1.部件-添加-可插入对象--选择excel 表格就可以在窗体添加该表格控件
2.工程-引用-Microsoft Excel 11.0 Object Library
下面给个简单的例子
Private Sub Command1_Click()
Dim xlExcel As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim AppExcel As Object
Set xlExcel = CreateObject("Excel.Application")
xlExcel.Workbooks.Open "C:\test.xls"
Set xlBook = xlExcel.Workbooks("test.xls")
Set xlSheet = xlBook.Worksheets(1)
Text1.Text = xlSheet.Cells(1, 1).Value
Text1.Text = Text1.Text & "ADD"
xlSheet.Cells(1, 1).Value = Text1.Text
Application.DisplayAlerts = False
xlBook.Close SaveChanges:=True
Application.DisplayAlerts = True
End Sub
2013-12-02
2013-12-02
不如说需求 更直接一些