|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a table in my Word document (Table1). How do I code my macro to select the first or last row? Thank you.
|
|
#2
|
|||
|
|||
|
I found the answer in another forum:
Dim oTable As Table Dim rngRow As Range Dim iRow As Integer Set oTable = ActiveDocument.Tables(1) iRow = oTable.Rows.Count Set rngRow = oTable.Rows(iRow).Range rngRow.Collapse direction:=wdCollapseStart |
|
#3
|
|||
|
|||
|
... Now I just need to figure out how to move to the next cell. Ideas?
|
|
#4
|
|||
|
|||
|
The following works better because it does not require the insertion point to be in the table for it to work:
Dim oTable As Table Dim rngRow As Range Dim iRow As Integer Set oTable = ActiveDocument.Tables(1) iRow = oTable.Rows.Count Set rngRow = oTable.Rows(iRow).Range ActiveDocument.Tables(1).Rows(iRow).Select Selection.InsertRowsBelow Now, how do I move from cell to cell? I'm still working on this... Any ideas? |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > VB for Apps - Word Macro Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|