VB.NET EXCEL Read, Write / VB.NET 엑셀 읽고, 쓰기

2016. 7. 20. 15:08IT/Visual Basic (.Net)

반응형

 

참조 - COM - Microsoft Excel 14.0 object Library 사용하면 됩니다!!

없으면 하위버젼도 상관없어요!!

    Private Sub excel()
        Dim xls As New Excel.Application
        Dim xworkbook As Excel.Workbook
        Dim xworksheet As Excel.Worksheet
        Dim xRange As Excel.Range

        Dim xlotno As String

        xworkbook = xls.Workbooks.Open("E:\12345.xls")

        xworksheet = xworkbook.Sheets(1)

        xRange = xworksheet.Range("A1")

        xlotno = xRange.Value 'Read

        MsgBox(xlotno)

        'Write
        'xRange = "TEST"

        xworkbook.Close()
        xls.Quit()
    End Sub

반응형