读取A2单元格的代码:(数据在变量R中,工程前需引用MICROSOFT EXCEL OBJECT LIBRARY)
Private excelApp As excel.Application
Private Sub Command2_Click()
Set excelApp = New excel.Application
excelApp.Visible = True
excelApp.Workbooks.Open FileName:="C:\student.xls"
excelApp.Range("A2").Select
r = excelApp.ActiveCell.FormulaR1C1
Debug.Print r
excelApp.Quit
Set excelApp = Nothing
End Sub
'不愿意让大家看到EXCEL界面的,就把 excelApp.Visible = True去掉。
温馨提示:答案为网友推荐,仅供参考