Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert multiple tables to Microsoft word

Status
Not open for further replies.

theresatan

Programmer
Mar 18, 2002
101
US
Hi,

I need to add two tables to a Microsoft word document

Dim objWord
Set objWord=CreateObject("Word.Application")
objWord.Visible = True
Set oDoc = objWord.Documents.Add
Set oTable = oDoc.Tables.Add(oDoc.Range(0,0), 6, 4)
Set oTable2 = oDoc.Tables.Add(oDoc.Range(0,0),5, 4)

It creates table2 inside table1(nested)

How to created two seperated tables.

Thanks!

Theresa

 
Have you tried to play with the macrorecorder when manually creating the 2 tables ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Just move the Selection forward, then add the next table. You will probably have to go to the end of the docu, add a paragraph, something like:

Code:
Set oTable = oDoc.Tables.Add(oDoc.Range(0,0), 6, 4)
    Selection.EndKey Unit:=wdStory
    Selection.TypeParagraph
Set oTable2 = oDoc.Tables.Add(oDoc.Range(0,0),5, 4)

Gerry
See my Paintings and Sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top