|
-
Sep 27th, 1999, 09:56 PM
#1
Thread Starter
New Member
I'm trying to save the information in my Grid to an Excel Sheet but I'm getting an error "Method or Datamembership not found". It's not accepting the property DataGrid1.Rows or Cols. Is there anyway to solve this problem. Please help.
Dim xlApp As New Excel.Application
Dim xlSheet As Worksheet
Dim xlBook As Workbook
Dim iCol As Integer
Dim iRow As Integer
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
For iRow = 0 To DataGrid1.Rows - 1
DataGrid1.Row = iRow
For iCol = 0 To DataGrid1.Cols - 1
DataGrid1.Col = iCol
xlSheet.Cells(iRow + 1, iCol + 1) = DataGrid1.Text
Next
Next
xlBook.SaveAs "C:\MyGridFile.xls"
xlSheet.Application.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
[This message has been edited by Susrutha (edited 09-28-1999).]
[This message has been edited by Susrutha (edited 09-28-1999).]
-
Sep 29th, 1999, 12:45 AM
#2
Frenzied Member
For the number of rows in your Datagrid, try using the
ApproxCount property (or the recordset's recordcount property for the grid's bound control)
For the number of columns, try
columns.count
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|