哪里有VB和EXCEL相连,互相读取、操作数据的教程
2个回答
展开全部
Private Sub Command1_Click()
Dim ExApp As New Excel.Application
Dim Exb As Excel.Workbook
Dim Exsh As Excel.Worksheet
Dim R1 As Excel.Range
ExApp.Workbooks.Open "D\my ducuments\book1.xls"
Set Exb = ExApp.Workbooks(1)
Set Exsh = Exb.Worksheets("Sheet1")
Text1.Text = Exsh.Range("D4")
ExApp.Workbooks.Close
ExApp.Quit
Set ExApp = Nothing
End Sub
运行前要在菜单的“工程”-“引用”-找到Microsoft Excel 的lib库才可以运行
Dim ExApp As New Excel.Application
Dim Exb As Excel.Workbook
Dim Exsh As Excel.Worksheet
Dim R1 As Excel.Range
ExApp.Workbooks.Open "D\my ducuments\book1.xls"
Set Exb = ExApp.Workbooks(1)
Set Exsh = Exb.Worksheets("Sheet1")
Text1.Text = Exsh.Range("D4")
ExApp.Workbooks.Close
ExApp.Quit
Set ExApp = Nothing
End Sub
运行前要在菜单的“工程”-“引用”-找到Microsoft Excel 的lib库才可以运行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询