TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Here is a kludgy method that works, assuming the cursor is still somewhere in the table you created. It moves to the last row of the table, then to the last cell of that row, and then down TWO lines.
If you move only one line you end up at the odd spot to the right of the last table row.
WdCollapseEnd just moves the selection to a single cursor at the end of the former selection. If you already have just a cursor it doesn't do anything visible.
You could cut this down to one move by calculating the number of cells to move, and then doing something like
Selection.Move unit = wdCell, Count = (calculated number of cells-1)
There are probably more sophisticated ways to do this, using the GoTo method of the selection. In all cases, the key is to get to the last cell of the table, then move down by two lines.
The cursor doesn't have to be in the first cell, since moves by unit that try to move by more units than exist (i.e. by 7 rows when you're already in the 6th row) just go to the max for that unit.
Also, you might want to look up the Information property. Lots of good stuff there.
Sub moveItOnOut()
If Selection.Information(wdWithInTable) = True Then
' go to the last row
Selection.Move unit:=wdRow, Count:=Selection.Tables(1).Rows.Count
' go to the last cell of that row
Selection.Move unit:=wdCell, Count:=Selection.Tables(1).Columns.Count
' Now move down two lines, beyond the table end
Selection.Move unit:=wdLine, Count:=2
End If
End Sub
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create and publish documentation through multiple channels with Doc-To-Help.
Choose your authoring formats and get any output you may need. Try
Doc-To-Help, now with MS SharePoint integration, free for 30-days. http://www.doctohelp.com
---
You are currently subscribed to TECHWR-L as archive -at- web -dot- techwr-l -dot- com -dot-