منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : تصدير عمود معين
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
On Error Resume Next
 Dim oExcel As Excel.Application
   Dim oWB As Excel.Workbook
   Dim xlsheet As Excel.Worksheet
   Set oExcel = New Excel.Application
   Dim xlsFileName As String
   xlsFileName = App.Path & "\Data.xls"
   Dim oRng1 As Excel.Range
   Dim oRng2 As Excel.Range
   Dim row0, col0, icol, irow As Integer
   Set oWB = oExcel.Workbooks.add
   Set xlsheet = oWB.Worksheets(1)
   For row0 = 1 To MSHFlexGrid1.Rows - 1
   For col0 = 0 To MSHFlexGrid1.Cols - 1
   If MSHFlexGrid1.ColWidth(col0) > 0 Then
   xlsheet.Cells(row0 + 1, col0 - 0).Value = MSHFlexGrid1.TextMatrix(row0, col0)
    xlsheet.Cells(row0 + 1, col0 - 0).Font.Name = "Tahoma"
    xlsheet.Cells(row0 + 1, col0 - 0).Font.Bold = False:
    xlsheet.Cells(row0 + 1, col0 - 0).Font.Size = 11:
   xlsheet.Columns(col0).AutoFit
   End If
   Next
   Next
   oExcel.Visible = True
   Set oWB = Nothing
   Set oExcel = Nothing
   KewlButtons6.Enabled = True[/code]

ازاي من هذا الكود اصدر عمود واحد الى الاكسل ويكون في العمود A   

'MSHFLEXGRID عن طريقها

ارجو التعديل في الكود
بارك الله فيك ...لكن بيتصدر  في العمود E من الاكسل


عايزه يتصدر في الاكسل العمود A