Results 1 to 2 of 2

Thread: Export Data to Excel

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 1999
    Posts
    1

    Post

    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).]

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    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
  •  



Click Here to Expand Forum to Full Width