1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Dim APP As New Microsoft.Office.Interop.Excel.Application 'Application Excel
Dim workbook As Microsoft.Office.Interop.Excel.Workbook 'Classeur Excel
Dim worksheet As Microsoft.Office.Interop.Excel.Worksheet 'Feuille Excel
workbook = APP.Workbooks.Open(Principal.txt_source.Text)
worksheet = workbook.Worksheets("Feuil1")
Dim DerLig As Integer = worksheet.UsedRange.SpecialCells(XlCellType.xlCellTypeLastCell).Row
Dim nbCells As Integer = data_modif1.cell
For i = 0 To data_modif1.RowCount - 1
For j = 0 To data_modif1.ColumnCount - 1
For k As Integer = 1 To data_modif1.Columns.Count
worksheet.Cells((DerLig + 1) + i, j + 1).value = data_modif1.Rows(i).Cells(j).Value.ToString()
Next
Next
Next
'On sauvegarde le fichier
workbook.Save()
'On ferme le fichier
workbook.Close()
'On ferme l'instance d'Excel
APP.Quit() |
Partager