السلام عليكم.....
ارجو المساعدة ومساعدتي بتعلم تصدير بيانات داتا غريد الى ملف word في بيئة فيجوال 6
ويا حبذا ان كان هناك مثال او مشروع مرفق
ولكم الشكر جميعا
أخوتي الاكارم
ما زلت انتظر نخوتكم والاجابة
وشكرا
يرجى المساعدة للضرورة
وشكرا
وعليكم السلام ورحمة الله وبركاته ..
بإمكانك الاستفادة من هذا الكود ..
وعدل عليه ليصبح كما تشاء ..
كود :
Private Sub Command1_Click()
' قم بإضافة مكتبة الوورد من المكتبات
'=========================================
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table
Dim oPara1 As Word.Paragraph, oPara2 As Word.Paragraph
Dim oPara3 As Word.Paragraph, oPara4 As Word.Paragraph
Dim oRng As Word.Range
Dim oShape As Word.InlineShape
Dim oChart As Object
Dim Pos As Double
'فتح وانشاء صفحة جديدة من وورد.
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add
'من أجل عنوان الصفحة.
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Heading 1"
oPara1.Range.Font.Bold = True
oPara1.Format.SpaceAfter = 24 '24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter
'إضافة عنوان فرعي مثلاً
Set oPara2 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks("\endofdoc").Range)
oPara2.Range.Text = "Heading 2"
oPara2.Format.SpaceAfter = 6
oPara2.Range.InsertParagraphAfter
'وضع شرح قبل الجدول ..
Set oPara3 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks("\endofdoc").Range)
oPara3.Range.Text = "This is a sentence of normal text. Now here is a table:"
oPara3.Range.Font.Bold = False
oPara3.Format.SpaceAfter = 24
oPara3.Range.InsertParagraphAfter
'عمل جدول وتعبئة البيانات فيه
Dim r As Integer, c As Integer
Set oTable = oDoc.Tables.Add(oDoc.Bookmarks("\endofdoc").Range, 3, 5)
oTable.Range.ParagraphFormat.SpaceAfter = 6
For r = 1 To 3
For c = 1 To 5
oTable.Cell(r, c).Range.Text = "r" & r & "c" & c ' بإمكانك هنا وضع الداتا جريد هنا لتأخذ البيانات منها
Next
Next
oTable.Rows(1).Range.Font.Bold = True
oTable.Rows(1).Range.Font.Italic = True
' بإمكانك هنا تعديل الرقم من 1 حتى 40 للاستفادة من أشكال وتنسيقات الجداول المخزنة في الوورد
oTable.AutoFormat 40, True, True, , True, , , , , True
End Sub
لك تحيتي....
هل يمكن أن تضعه بملف نص وترفقه
ولك كل شكري