تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تصدير البيانات الي ملف اكسل .. ارجوا مساعدتكم
#1
[align=right]بسم الله الرحمن الرحيم

الاخوة الاعزاء اسعد الله مساكم اين ماكنتم  ووفقكم الي الخير

حقيقتا لدي اشكال في الكود الذي سوف ارفقه ادناه وما اعانية انه عندما اصدر البيانات الي ملف اكسل اجد البيانات تتكرر ولايتم جلب كافة البيانات المطلوبة

إقتباس :Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM actions ORDER BY ordernumber", cn, adOpenStatic, adLockOptimistic
If rs.RecordCount <= 0 Then
   MsgBox "áÇ ÊæÌÏ ÈíÇäÇÊ Ýí ÇáÞÇÚÏÉ ÇáÈíÇäÇÊ"
Else
   
   CommonDialog1.CancelError = True
   On Error GoTo ErrHandler
   
   Set xlApp = CreateObject("Excel.Application")
   xlApp.SheetsInNewWorkbook = 1
   xlApp.Visible = True
   Set xlBook = xlApp.Workbooks.Add
   xlApp.Windows(1).ActiveSheet.Name = "sheet"
   
   
   
   Set xlSheet = xlBook.Worksheets("Sheet")
   
   xlSheet.Range("B6").CopyFromRecordset rs
    xlSheet.cells(3, 3).Value = Date
    xlSheet.cells(3, 1).Value = "Report printed "


   xlSheet.cells(5, 2).columnWidth = 5
   xlSheet.cells(5, 1).columnWidth = 5

   xlSheet.cells(5, 1).Value = "Ê"
   xlSheet.cells(5, 1).columnWidth = 3
     
   xlSheet.cells(5, 2).columnWidth = 10
   xlSheet.cells(5, 2).Value = "ÇãÑ ÇáÚãá"
   
   xlSheet.cells(5, 3).columnWidth = 10
   xlSheet.cells(5, 3).Value = "ÑÞã ÇáãÎØØ"
   
   xlSheet.cells(5, 4).columnWidth = 14
   xlSheet.cells(5, 4).Value = "ãÌãæÚ ÇáãÎØØÇÊ"
   
   xlSheet.cells(5, 5).columnWidth = 10
   xlSheet.cells(5, 5).Value = "ÇáãÞÓã"
   
   xlSheet.cells(5, 6).columnWidth = 10
   xlSheet.cells(5, 6).Value = "ÇáßÈíäå"
   
   xlSheet.cells(5, 7).columnWidth = 10
   xlSheet.cells(5, 7).Value = "äæÚ ÇáÚãá"
   
   xlSheet.cells(5, 8).columnWidth = 10
   xlSheet.cells(5, 8).Value = "SITE FOC"
   
   xlSheet.cells(5, 9).columnWidth = 10
   xlSheet.cells(5, 9).Value = "RACK"
   
   xlSheet.cells(5, 10).columnWidth = 10
   xlSheet.cells(5, 10).Value = "POSTION"
   
   xlSheet.cells(5, 11).columnWidth = 10
   xlSheet.cells(5, 11).Value = "Fiber"
   
   xlSheet.cells(5, 12).columnWidth = 10
   xlSheet.cells(5, 12).Value = "Capillaries"
   
   xlSheet.cells(5, 13).columnWidth = 10
   xlSheet.cells(5, 13).Value = "NEW_DP"
   
   xlSheet.cells(5, 14).columnWidth = 10
   xlSheet.cells(5, 14).Value = "FIM"
   
   xlSheet.cells(5, 15).columnWidth = 10
   xlSheet.cells(5, 15).Value = "DP"
   
   xlSheet.cells(5, 16).columnWidth = 10
   xlSheet.cells(5, 16).Value = "BSW"
   
   xlSheet.cells(5, 17).columnWidth = 10
   xlSheet.cells(5, 17).Value = "REMARKS"
   
   xlSheet.cells(5, 18).columnWidth = 10
   xlSheet.cells(5, 18).Value = "FOC_Type"
   
   xlSheet.cells(5, 19).columnWidth = 10
   xlSheet.cells(5, 19).Value = "DB_Type"
   
   xlSheet.cells(5, 20).columnWidth = 10
   xlSheet.cells(5, 20).Value = "ÈÏÇíÉ ÇáÚãá"
   
   xlSheet.cells(5, 21).columnWidth = 10
   xlSheet.cells(5, 21).Value = "ÇÞÝÇá ÇáÚãá"
   
   xlSheet.cells(5, 22).columnWidth = 10
   xlSheet.cells(5, 22).Value = "ÇáãÞÇæá"
   
   xlSheet.cells(5, 23).columnWidth = 10
   xlSheet.cells(5, 23).Value = "ÇáãÝÊÔ"
   
   xlSheet.cells(5, 24).columnWidth = 14
   xlSheet.cells(5, 24).Value = "ÊÇÑíÎ ÊÓÌíá ÇáÚãá"
   
   xlSheet.cells(5, 25).columnWidth = 10
   xlSheet.cells(5, 25).Value = "ÍÇáÉ ÇáÚãá"
 
   xlSheet.cells(5, 26).columnWidth = 80
   xlSheet.cells(5, 26).Value = "ãáÇÍÙÇÊ"

   xlSheet.Range("a5:z5").Font.Bold = True
   
   xlSheet.cells(6, 1).Value = 1
   xlSheet.cells(7, 1).Value = 2
   
   xlSheet.Range("a6:B7").AutoFill Destination:=xlSheet.Range("a6:B" & rs.RecordCount + 5), Type:=xlLinearTrend

   xlSheet.Range("a5:z" & rs.RecordCount + 5).Borders.Weight = xlThin
   xlSheet.Range("a5:z" & rs.RecordCount + 7).Font.Size = 10
   xlSheet.Range("a5:z" & rs.RecordCount + 7).Font.Color = &H404080

   xlSheet.Range("a5:z" & rs.RecordCount + 7).Font.Name = "Times New Roman"
   xlSheet.Range("a5:z" & rs.RecordCount + 7).HorizontalAlignment = xlCenter
   xlSheet.Range("a5:z" & rs.RecordCount + 7).VerticalAlignment = xlVAlignCenter
   
   xlSheet.Range("F" & rs.RecordCount + 7).NumberFormat = "###,##0.00"
   xlSheet.Range("E" & rs.RecordCount + 7 & ":F" & rs.RecordCount + 7).Font.Bold = True
   xlSheet.Range("E" & rs.RecordCount + 7 & ":F" & rs.RecordCount + 7).Borders.Weight = xlThin
End If

ErrHandler:
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
تصدير البيانات الي ملف اكسل .. ارجوا مساعدتكم - بواسطة ابومحمد1979 - 10-02-15, 11:40 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [سؤال] تصدير تقرير بال ActiveReport الى PDF layan2000 4 607 24-11-24, 05:56 PM
آخر رد: layan2000
  مشكلة الللغة العربية في تصدير اكتيف ريبورت الى PDF hannileo 3 1,225 19-11-24, 08:25 PM
آخر رد: layan2000
  اضافة الصور الى ملف واسترجاعها بدون قاعدة البيانات haitham Muhammed 0 807 21-01-24, 12:58 PM
آخر رد: haitham Muhammed
  [vb6.0] تصدير البيانات محمد عياش 0 684 12-12-22, 07:10 PM
آخر رد: محمد عياش
  بخصوص صيغة التاريخ عند الحفظ في قاعدة البيانات hannileo 0 795 03-07-22, 12:19 PM
آخر رد: hannileo
  [سؤال] كيفية استيراد ملف اكسل الى قاعدة بيانات اكسس في فيجوال 6 sher 12 9,551 14-06-22, 04:01 PM
آخر رد: sher
  [vb6.0] طلب : كود عرض نص معين من قاعدة البيانات وعرضه في label في داتا ريبورت hamada salah90 3 1,862 26-07-21, 06:43 PM
آخر رد: hamada salah90
  [vb6.0] استرداد ملف اكسل mahtawfik 0 1,040 07-07-21, 05:07 PM
آخر رد: mahtawfik
  [vb6.0] أريد شرح مبسط وواضح للعلاقات بين جداول قاعدة البيانات وشرح الإستعلامات بهذه العلاقات hamada salah90 0 1,236 01-06-21, 02:12 AM
آخر رد: hamada salah90
  عندي مشكلة وهي عند تصدير ملف إكسل rami_cis 0 1,253 16-12-20, 12:28 AM
آخر رد: rami_cis

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم