Computer Aided Automation
VB.NET : Write to excel file - sample code - Printable Version

+- Computer Aided Automation (https://computeraidedautomation.com)
+-- Forum: CAA Discussions (https://computeraidedautomation.com/forum-7.html)
+--- Forum: Programming Languages (https://computeraidedautomation.com/forum-11.html)
+---- Forum: VB.NET (https://computeraidedautomation.com/forum-15.html)
+---- Thread: VB.NET : Write to excel file - sample code (/thread-10.html)



VB.NET : Write to excel file - sample code - admin1 - 23-11-2019

sample code Write to excel file

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()