Hi,![]()
Sure here it comes.
Because I don't know exactly how you want your table filled I'll make this an example of how to fill a Word table from excel using an existent table.
Before you run it check the reference in the VBE. (Read code remark)
[VBA]
Option Explicit
Sub FillWordTable()
'Before Run Go to Tools/Reference and check the right reference to:
'Microsoft Word 11.0 Object Library (if you have xp it will be 10.0 / 2000 9.0 etc...)
Dim oApp As New Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table
Dim sPath As String, iCol As Integer, iRow As Integer
sPath = ThisWorkbook.Path & _
Application.PathSeparator & "Test.doc"
Application.ScreenUpdating = False
With oApp
Set oDoc = .Documents.Open(Filename:=sPath)
Set oTable = oDoc.Bookmarks("bk1").Range.Tables(1)
For iCol = 1 To oTable.Columns.Count
For iRow = 1 To oTable.Rows.Count
oTable.Cell(iRow, iCol).Range.Text = _
Application.Worksheets("Sheet1").Cells(iRow, iCol).Value
Next
Next
.Visible = True
.Activate
.WindowState = wdWindowStateMaximize
End With
Set oTable = Nothing
Set oDoc = Nothing
Set oApp = Nothing
End Sub
[/VBA]
See Attachment
The code is setup in a way you can run it as is. (no need to change the path just run via the button)
Enjoy!![]()