21, Feb, 2019

VB.NET : Write to excel file – simple

write to excel file

Write to excel file – Simple example

 Dim APP As New Excel.Application

        Dim worksheet As Excel.Worksheet

        Dim workbook As Excel.Workbook

        workbook = APP.Workbooks.Open(“D:\excelfile.xlsx”)

        worksheet = workbook.Worksheets(“Sheet1”)

        Dim iter1 As Integer

        For iter1 = 1 To 50

            ‘Add data to cells of the first worksheet in the new workbook

            worksheet.Cells(1, iter1).Value = D(iter1)

        Next

        ‘Save the Workbook and Quit Excel

        workbook.Save()

        workbook.Close()

        APP.Quit()

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>