Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
word table
I should write a VBA code that creates a table in a Word
sheet. This table has to contain values coming from an Excel sheet.....help me please!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
word table
v
Here's an example. Set a reference (VBE - Tools - References) to the Microsoft Word x.x Object Library. Sub maketable() Dim wd As Word.Application Dim wdDoc As Word.Document Dim i As Long Dim j As Long Set wd = New Word.Application Set wdDoc = wd.Documents.Add wd.Visible = True wdDoc.Tables.Add wd.Selection.Range, _ Selection.Rows.Count, Selection.Columns.Count With wdDoc.Tables(1) For i = 1 To .Rows.Count For j = 1 To .Columns.Count .Cell(i, j).Range.Text = _ Selection.Cells(i, j).Value Next j Next i End With End Sub "v." wrote in message ... I should write a VBA code that creates a table in a Word sheet. This table has to contain values coming from an Excel sheet.....help me please!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table in word | Excel Discussion (Misc queries) | |||
Word table to Excel | Excel Discussion (Misc queries) | |||
Pasting from Word Table | Excel Discussion (Misc queries) | |||
Link table from excel to word using word VBA | Excel Discussion (Misc queries) | |||
Paste from Word table so that 1 table cell = 1 Excel cell | Excel Discussion (Misc queries) |