#1   Report Post  
Posted to microsoft.public.word.docmanagement
rahul4real[_4_] rahul4real[_4_] is offline
external usenet poster
 
Posts: 1
Default Appending tables


I have got a word document that already contains a table. I need to
write a MS word macro to append one more table after the existing table
in the same word document.When i write the following code:
set oTable = oDoc.Tables.Add(.......)

i get the new table overwritten on to the existing table. How can i
overcome this problem...
Please help!!
Thanks in advance


--
rahul4real
------------------------------------------------------------------------
rahul4real's Profile: http://www.thecodecage.com/forumz/member.php?userid=377
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=108824

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Appending tables

Dim trange As Range
Dim otable As Table
With ActiveDocument
Set trange = .Range
trange.Collapse wdCollapseEnd
Set otable = .Tables.Add(trange, 2, 2)
End With

or, if you want a space between the two tables

Dim trange As Range
Dim otable As Table
With ActiveDocument
.Range.InsertAfter vbCr
Set trange = .Range
trange.Collapse wdCollapseEnd
Set otable = .Tables.Add(trange, 2, 2)
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"rahul4real" wrote in message
...

I have got a word document that already contains a table. I need to
write a MS word macro to append one more table after the existing table
in the same word document.When i write the following code:
set oTable = oDoc.Tables.Add(.......)

i get the new table overwritten on to the existing table. How can i
overcome this problem...
Please help!!
Thanks in advance


--
rahul4real
------------------------------------------------------------------------
rahul4real's Profile:
http://www.thecodecage.com/forumz/member.php?userid=377
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=108824


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2002 Appending one document to another. billbruen Page Layout 1 November 13th 07 01:28 PM
appending pages to a word file? Joe[_3_] Microsoft Word Help 1 June 7th 07 06:28 PM
When I highlight text it is appending instead of replacing? Ghost Microsoft Word Help 1 August 23rd 06 07:19 PM
template appending to merged document [email protected] Mailmerge 2 August 9th 05 05:20 PM
Appending word documents - Part 2 Cheryl B. Microsoft Word Help 0 May 4th 05 06:21 PM


All times are GMT +1. The time now is 01:20 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"