I have some code that selects a row in a table then hides it.
The next step is to see if the the selected object was the whole table.
if it is then hide the next blank paragraph
CODE:
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Font.Italic = True
.Font.Color = wdColorBlue
.Font.Hidden = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
'Loop through and find all tables and hide the tables
While Selection.Find.Found
If Selection.Tables(1).Rows.Borders(1).Color = wdColorAutomatic
Or _
Selection.Tables(1).Rows.Borders(1).Color = wdColorBlack
Then
Selection.SelectRow
Selection.Font.Hidden = True
If Selection "if whole table is selected" = True Then
Selection.Move unit:=wdParagraph, Count:=1
Selection.Paragraphs(1).Range.Select
Selection.Font.Hidden = True
End If
End If
Selection.HomeKey unit:=wdStory
Selection.Find.Execute
Wend
Tony Jollans - 05 Oct 2005 16:57 GMT
Why not just check the table's Rows.Count?
If it's 1 then the one row you selected must have been the whole table.
Slightly more generally you could compare the selection's Rows.Count against
the table's.
--
Enjoy,
Tony
> I have some code that selects a row in a table then hides it.
> The next step is to see if the the selected object was the whole table.
[quoted text clipped - 38 lines]
> Selection.Find.Execute
> Wend
frogman - 05 Oct 2005 19:48 GMT
Thanks i totally missed that.
It works great.
frogman - 12 Oct 2005 15:13 GMT
I found a better solution
If Selection.Rows.Last.IsLast Then
Selection.Move unit:=wdParagraph, Count:=1
Selection.Paragraphs(1).Range.Select
Selection.Font.Hidden = False
End If
Greg - 05 Oct 2005 16:57 GMT
Well if the select row was the whole table then perhaps:
If Selection.Tables(1).Rows.Count = 1 Then