#1   Report Post  
Posted to microsoft.public.excel.programming
v. v. is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Table in word Jithu Excel Discussion (Misc queries) 2 October 29th 07 05:57 PM
Word table to Excel [email protected][_2_] Excel Discussion (Misc queries) 1 September 27th 07 01:40 PM
Pasting from Word Table Eric Excel Discussion (Misc queries) 3 March 22nd 07 06:53 PM
Link table from excel to word using word VBA [email protected] Excel Discussion (Misc queries) 7 January 9th 07 05:57 PM
Paste from Word table so that 1 table cell = 1 Excel cell Dave G Excel Discussion (Misc queries) 4 June 17th 05 12:16 AM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"