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!! |
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!! |
All times are GMT +1. The time now is 01:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com