i've just used the export to excel code (works great) and i've modified it to include the column and row headings
VB Code:
Dim q As Long Dim p As Long Dim newCell As String Dim xl As Excel.Application Set xl = CreateObject("excel.application") xl.Workbooks.Open ("D:\University\3rd Year\Final Year Project\My Results\Book1") DoEvents xl.Visible = True For p = 0 To MSFlexGrid1.Rows - 1 For q = 0 To MSFlexGrid1.Cols - 1 MSFlexGrid1.Col = q MSFlexGrid1.Row = p newCell = Chr(q + 65) & p + 1 xl.Worksheets("Sheet1").Range(newCell).Value = MSFlexGrid1.Text Next Next




Reply With Quote