F
frogman
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
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