I'm using Word 2013 in Windows 7.
I've got a document with a number of pages into which I've added a last page in a new separate section. The cursor is sitting in the body of this last page.
The footer is 'not the same as previous'.
In the footer of this section, I have a table with a carriage return just below it. The table consists of two rows: the top row is one complete cell stretching across the width of the table. The lower row consists of three cells. In the cell in column 3 of this row is a piece of text I want to delete.
At present, I'm using the code below to select the last cell and delete its contents. It works if I process the code row by row. However, when I let it do its own thing it somehow deletes the contents of the second column and leaves the third one intact!
'now works in the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
With Selection
.PageSetup.DifferentFirstPageHeaderFooter = False
.HeaderFooter.LinkToPrevious = False
With ActiveWindow.ActivePane.View
.SeekView = wdSeekMainDocument
.SeekView = wdSeekCurrentPageFooter
End With
With Selection
.MoveUp Unit:=wdLine, Count:=1
.SelectCell
.MoveRight Unit:=wdWord, Count:=2
.SelectCell
.Delete Unit:=wdCharacter, Count:=1
End With
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
I've searched in Google and in this forum and found a number of references about using ranges. However, I can't seem to get the right combination. They fail miserably!
What I'm trying to achieve using pseudo-code is to say: "Go to the footer of this section and find the table within it. Then go to the third cell in the second row and delete its contents.
The code above is rather a convoluted way to achieve this. And anyway, it doesn't seem to work like I want it to.
Could anyone suggest a better way, please?