![]() If System.IO.File.Exists(strFileName) ThenĮnd SubNow when I create a excel file to which the datagridview needs to be exported I also wanna include a macro ![]() ![]() If (( = 0) Or ( = 0)) Thenįor i As Integer = 0 To DataGridView2.ColumnCount - 1ĭset.Tables(0).Columns.Add(DataGridView2.Columns(i).HeaderText)įor i As Integer = 0 To DataGridView2.RowCount - 1įor j As Integer = 0 To - 1ĭr1(j) = DataGridView2.Rows(i).Cells(j).Valueĭim excel As New .Applicationĭim wBook As .Workbookĭim wSheet As .Worksheetĭim dt As = dset.Tables(0)Įxcel.Cells(rowIndex + 1, colIndex) = dr(dc.ColumnName)ĭim strFileName As String = "my filepath.xlsx"ĭim fileTemp As System.IO.FileStream = System.IO.File.OpenWrite(strFileName) Code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |