CodeItBetter Programming Another VB Programming Blog

How to get data from Excel Worksheet

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'MS Office - How to get data from Excel Worksheet

'Add a Command Button to your form and set reference to Microsoft Excel xx.x Object Library

Private Sub Command1_Click()
    Dim xl As New Excel.Application
    Dim xlw As Excel.Workbook
    Set xlw = xl.Workbooks.Open("C:\Temp\Book11.xls")
    xlw.Sheets("Sheet1").Select
    MsgBox xlw.Application.Cells(2, 3).Value
    xlw.Close False
    Set xlw = Nothing
    Set xl = Nothing
End Sub
Filed under: MS Office Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.