vb怎么读取excel指定单元格数据

如读取c:尀12.xls文件中a2单元格的数据。
2024-12-04 14:57:31
推荐回答(2个)
回答1:

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Private Function ReadA2() As String
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("c:\12.xls")
Set xlSheet = xlBook.Worksheets("Sheet1")
你想要的 = xlSheet.cells(2, 1) '或者加上.Value
End Function

回答2:

提问者:匿名