Try this:
'-- Put this at the top
Imports Office = Microsoft.Office.Core
Imports Excel = Microsoft.Office.Interop.Excel
Private Sub CreateSpreadSheetFromDataSet()
Dim Excel As New Excel.Application
Dim oBook As Excel.Workbook
Dim WSheet As New Excel.Worksheet
WSheet = Excel.Workbooks.Add.Worksheets.Add
Excel.Visible = True
Dim rows As Integer
Dim columns As Integer
Dim r As Integer
Dim c As Integer
Dim DataArray(rows, columns) As Object
For c = 0 To columns - 1
DataArray(r, c) = dstest.Tables(0).Columns.Item(c).ColumnName
For r = 0 To rows - 1
DataArray(r, c) = dstest.Tables(0).Rows(r).Item(c)
Next
Next
WSheet.Range("A2").Resize(rows, columns).Value = DataArray
Dim columns2 as Integer
Dim columns3 as Integer = 1
For columns2 = 0 To dstest.Tables(0).Columns.Count - 1
WSheet.Cells(1, columns3).Value =
dstest.Tables(0).Columns(columns2).ColumnName
columns3 = columns3 + 1
Next
End Sub
Private Function closeExcel() As Short
Dim count As Short = 0
Dim excelInstance As System.Diagnostics.Process
Dim excelInstances() As Process =
System.Diagnostics.Process.GetProcessesByName("Exc el")
For Each excelInstance In excelInstances
Try
excelInstance.Close() '<-- you can use close or kill .. up to you
excelInstance.Kill()
count += 1
Catch ex As Exception
End Try
Next
Return count
End Function
"IAmIronMan" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Because no one will answer me.........scorpion emailed
everyone telling them not to help me.
He (acting like a she) isn't responding to my posts.
Emailing him is out because his spam filter is rejecting
me.
I just need a little help here with this. Just paste the
code here what he wrote without all the other stuff on
there. When I do that I get errors all over the place.
-----Original Message-----
"IAmIronMan" <an*******@discussions.microsoft.com>
schrieb This person scorpion53061 wrote a code sample at
http://www.kjmsolutions.com/datasetarray.htm
in which he did not explain it well.
[.....]
Why not answer in the other thread? Nobody knows what
you were referring to.If you want to write a single person, ask him if you can
write him an email.
--
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
.