انا شغال على عرض فليكس جريد بحيث انه احول البيانات الى اكسل بس ناقص شي واحد وهو لمن العرض يتحول للاكسل , التصميم ما يكون نفسه اللي في الفليكس جريد , انا حاط الكود تحت يا ليت احد ينورني ويقولي ايش ازود علشان يطلع التصميم في الاكسل زي ما انا مصممه في الفليكس جريد.
وشكرا
-------------------------------------------------------------------------------------------------------
Private Sub Command5_Click()
Dim iRow As Integer
Dim iCol As Integer
Dim objExcl As Excel.Application
Dim objWk As Excel.Workbook
Dim objSht As Excel.Worksheet
Dim iHead As Integer
Dim vHead As Variant
Set objExcl = New Excel.Application
objExcl.Application.Visible = True
Set objWk = objExcl.Workbooks.Add
Set objSht = objWk.Sheets(1)
vHead = Split(Grid1.FormatString, "|")
'populate heading in the sheet
'take the column heading from flex grid and put it in the sheet
For iHead = 1 To UBound(vHead)
If Len(Trim(vHead(iHead))) > 0 Then objSht.Cells(1, iHead) = vHead(iHead)
Next
For iRow = 1 To Grid1.Rows - 1
For iCol = 1 To Grid1.Cols - 1
Grid1.Row = iRow
Grid1.Col = iCol
objSht.Cells(iRow + 1, iCol) = Grid1.Text
Next iCol
Next iRow
objWk.SaveAs "c:\output.xls"
objWk.Close
objExcl.Quit
Set objSht = Nothing
Set objWk = Nothing
Set objExcl = Nothing
End Sub