K
KeesBlunder
Guest
Hello ,
Found many example's from datagridview to Excel.
But i want to export it to a certain place in a existing file , how can i put this in this file ?
C:\Test\Gasolie
i know that i have to adjust this but cannot make it to work
xlexcel = New Excel.Application()
Private Sub copyAlltoClipboard()
dataGridView1.SelectAll()
Dim dataObj As DataObject = dataGridView1.GetClipboardContent()
If dataObj IsNot Nothing Then Clipboard.SetDataObject(dataObj)
End Sub
Private Sub button3_Click_1(ByVal sender As Object, ByVal e As EventArgs)
copyAlltoClipboard()
Dim xlexcel As Microsoft.Office.Interop.Excel.Application
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
xlexcel = New Excel.Application()
xlexcel.Visible = True
xlWorkBook = xlexcel.Workbooks.Add(misValue)
xlWorkSheet = CType(xlWorkBook.Worksheets.get_Item(1), Excel.Worksheet)
Dim CR As Excel.Range = CType(xlWorkSheet.Cells(15, 8), Excel.Range)
CR.[Select]()
xlWorkSheet.PasteSpecial(CR, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, True)
End Sub
End Class
Continue reading...
Found many example's from datagridview to Excel.
But i want to export it to a certain place in a existing file , how can i put this in this file ?
C:\Test\Gasolie
i know that i have to adjust this but cannot make it to work
xlexcel = New Excel.Application()
Private Sub copyAlltoClipboard()
dataGridView1.SelectAll()
Dim dataObj As DataObject = dataGridView1.GetClipboardContent()
If dataObj IsNot Nothing Then Clipboard.SetDataObject(dataObj)
End Sub
Private Sub button3_Click_1(ByVal sender As Object, ByVal e As EventArgs)
copyAlltoClipboard()
Dim xlexcel As Microsoft.Office.Interop.Excel.Application
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
xlexcel = New Excel.Application()
xlexcel.Visible = True
xlWorkBook = xlexcel.Workbooks.Add(misValue)
xlWorkSheet = CType(xlWorkBook.Worksheets.get_Item(1), Excel.Worksheet)
Dim CR As Excel.Range = CType(xlWorkSheet.Cells(15, 8), Excel.Range)
CR.[Select]()
xlWorkSheet.PasteSpecial(CR, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, True)
End Sub
End Class
Continue reading...