vb如何读取excel单元格数据?
那位高手解决如下问题? 我已能在VB中导入excel文件,但不知用什么语句读取excel工作表1中的单元数据。
原语句如下:
Private Sub Command1_Click()
Dim i As Long
Dim dddd As String
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
dddd = "sheet1" '准备打开指定的表
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Open("F:\6.文档文件夹\试验1.xls")
For i = 1 To xlBook.Worksheets.Count
If InStr(LCase(xlBook.Worksheets(i).Name), LCase(dddd)) > 0 Then
xlBook.Sheets(dddd).Select '打开book1中指定的sheet1表
xlApp.Visible = True
Exit For
End If
Next i
Dim mData(1, 1) As String
mData(1, 1) = xlSheet.Cells(1, 1) “这里提示错误”
Form1.Print mData(1, 1)
End Sub
谢谢