Can anyone tell me how in vba to locate the cursor in a
table and document.
I have a document with multiple tables what i want is to
create a vba procedure that the user can use to
automatically enter a new row at the end of the specific
table they are using.
So i need to loacte the table number they are in and send
the cursor to the end of the table and insert the new row.
Any ideas
Paul
Jezebel - 15 Jun 2004 09:52 GMT
Selection.Tables(1)
You might need to allow for the possibility that the selection spans more
than one table.
> Can anyone tell me how in vba to locate the cursor in a
> table and document.
[quoted text clipped - 10 lines]
>
> Paul
Helmut Weber - 15 Jun 2004 09:56 GMT
Hi Paul,
just one of several way as a start:
Dim oRng As Range
Set oRng = Selection.Range ' remember selection
Selection.Tables(1).Select
Selection.InsertRowsBelow 1
oRng.Select ' restore selection
---
Adds a row at the end of the first table
that is touched by the selection. You might like
to collapse the selection beforehand or check,
whether the cursor touches a table at all, or just
do nothing by in case, using a on error command.
Let us know if you need more help on this.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000