Exporting VB6 Datagrid to MS-Excel
Posted on 2004-04-29
I want to export the contents of my datagrid to an excel document..
what i have is almost working, except it will only send over the visible information... (i.e if the contents of the datagrid is longer than 1 page, it will not send the information contained "off the page" to excel). In the code itselfI have "VisibleRows" in it... there is no other argument I can find for DataGrid ...
This is the code I'm using:
Dim Appli as New Excel.Application
Appli.SheetsInNewWorkbook = 1
For i = 0 To DataGrid1.VisibleRows - 1
For j = 0 To DataGrid1.VisibleRows - 1
DataGrid1.Row = i
DataGrid1.Col = j
Appli.ActiveSheet.cells(i + 1, j + 1).Value = DataGrid1.Text