Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Add a row after the last row of a Word table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Newbie - 29 Oct 2006 13:19 GMT
Hello,

Now, I know how to add a row in a Word table. But I need to make sure that
this row will be added after the last row of the table. How can I do that
with VBA?
Thanks for your help.
Jay Freedman - 29 Oct 2006 18:06 GMT
If you call the Table.Rows.Add method and you don't supply a value for
the optional BeforeRow parameter, the new row will be added after the
last row.

To prove it to yourself, run this code in a document that contains at
least one table:

Sub Test()
   Dim nRow As Row
   With ActiveDocument.Tables(1)
       Set nRow = .Rows.Add
       If nRow.Index <> .Rows.Count Then
           MsgBox "Not the last row"
       End If
   End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>Hello,
>
>Now, I know how to add a row in a Word table. But I need to make sure that
>this row will be added after the last row of the table. How can I do that
>with VBA?
>Thanks for your help.
Newbie - 29 Oct 2006 19:18 GMT
Thanks again Jay!

> If you call the Table.Rows.Add method and you don't supply a value for
> the optional BeforeRow parameter, the new row will be added after the
[quoted text clipped - 26 lines]
> >with VBA?
> >Thanks for your help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.