PDA

View Full Version : رسم tabel در word



yasa_sabnet68
یک شنبه 22 آذر 1388, 15:52 عصر
سلام دوستان من reference و تمام قسمت های ورد رو میتونم بیارم غیر از رسم tabel ودسترسی به داخل اون:قهقهه:

Tasiyan
دوشنبه 23 آذر 1388, 10:09 صبح
Transfer FlexGrid Items to a Word Table (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=48732&lngWId=1)
:لبخند:

vbhamed
دوشنبه 23 آذر 1388, 10:49 صبح
سلام

اينم يك نمونه

از منوي Project گزينه References آيتم Microsoft Word 11 Object Library رو تيك بزنيد (البته براي Office 2003)



Private Sub Form_Load()

Dim WdApp As Word.Application

Dim x As Word.Document

On Error Resume Next

' Create a new Word document.
Dim WdDoc As New Word.Document

' The following two lines of code allow you to hook into the
' Word Application object.
Set WdApp = WdDoc.Parent
Set WdApp = WdDoc.Parent

WdApp.ActiveWindow.Visible = True

' Either one or two extra documents are opened by the two
' preceding lines of code. The following For Each loop closes the
' extra documents that are created by this subroutine. Any blank
' documents that have not been modified will be closed.
WdApp.ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:=5, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed

With WdApp.Selection.Tables(1)

If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If

.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With

WdApp.Selection.TypeText Text:="222"
WdApp.Selection.MoveRight Unit:=wdCell
WdApp.Selection.MoveRight Unit:=wdCell
WdApp.Selection.TypeText Text:="3333"

End Sub