Hi,
The following is an excerpt of code that sets a range going from row 2 of a
table to the last row and Hides it. It is intended to hide the range only
when needed (i.e., when it is not already hidden).

'============== Excerpt ==================
If NumOfRows > 1 Then
Set TypeOfInspCell = ActiveDocument.Range( _
Start:=otable.Rows(2).Range.Start, _
End:=otable.Rows(NumOfRows).Range.End)

If TypeOfInspCell.Font.Hidden = True Then
Exit Sub
Else
TypeOfInspCell.Font.Hidden = True
End If

End If
'===========================================

Nevertheless, when debugging, I realized that "TypeOfInspCell.Font.Hidden"
is always equal to 9999999, so it always goes through the else (even when the
range is already hidden).

Let me note that the alternate method of checking whether row 2 of the table
is hidden or not, does not work, since it may very well happen that Row 2 is
hidden but row 3 is unhidden. I'd have to loop through each row to detect
whether they're all hidden. Although this method does give
"TypeOfInspCell.Font.Hidden" a defined value, due to the tables massive size
of the tables, it takes too long to run.

Is there anyway I could make my initial code work?? Or is there any other
efficient method to accomplish this?

Thank you,

Juan Manuel

Re: Problem with Hidden Property of a Range by Jonathan

Jonathan
Wed Jul 23 09:51:25 PDT 2008

Hi Juan

Check the Hidden property of the first character in the range, which cannot
have the value 9999999 (wdUndetermined), and hide or unhide accordingly

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

"JuanManuel" <JuanManuel@discussions.microsoft.com> wrote in message
news:CDCB832B-B052-4EBC-8308-E23C092733FF@microsoft.com...
> Hi,
> The following is an excerpt of code that sets a range going from row 2 of
> a
> table to the last row and Hides it. It is intended to hide the range only
> when needed (i.e., when it is not already hidden).
>
> '============== Excerpt ==================
> If NumOfRows > 1 Then
> Set TypeOfInspCell = ActiveDocument.Range( _
> Start:=otable.Rows(2).Range.Start, _
> End:=otable.Rows(NumOfRows).Range.End)
>
> If TypeOfInspCell.Font.Hidden = True Then
> Exit Sub
> Else
> TypeOfInspCell.Font.Hidden = True
> End If
>
> End If
> '===========================================
>
> Nevertheless, when debugging, I realized that "TypeOfInspCell.Font.Hidden"
> is always equal to 9999999, so it always goes through the else (even when
> the
> range is already hidden).
>
> Let me note that the alternate method of checking whether row 2 of the
> table
> is hidden or not, does not work, since it may very well happen that Row 2
> is
> hidden but row 3 is unhidden. I'd have to loop through each row to detect
> whether they're all hidden. Although this method does give
> "TypeOfInspCell.Font.Hidden" a defined value, due to the tables massive
> size
> of the tables, it takes too long to run.
>
> Is there anyway I could make my initial code work?? Or is there any other
> efficient method to accomplish this?
>
> Thank you,
>
> Juan Manuel
>
>
>