Hide/Unhide a table according to the font color VBA/Word 2003

D

Domseeker

Hi everyone,
Different tables in one document, should be hidden or unhidden according to
the font color.
With the code
"If oTbl.range.font.color=wdcolorDarkRed then
oTbl.Range.font.hidden=True"
some tables are not recognized (code color value=999999
However the code "If oTbl.cell(1,1).range.font.color=wdcolorDarkRed.."
seems to work..
Is the first one, not working because of the number of rows, or something
else?

Thanks for your input
 
J

Jean-Guy Marcil

Domseeker said:
Hi everyone,
Different tables in one document, should be hidden or unhidden according to
the font color.
With the code
"If oTbl.range.font.color=wdcolorDarkRed then
oTbl.Range.font.hidden=True"
some tables are not recognized (code color value=999999
However the code "If oTbl.cell(1,1).range.font.color=wdcolorDarkRed.."
seems to work..
Is the first one, not working because of the number of rows, or something
else?

9999999 is usually returned when Word cannot identify a parameter, like font
size, cell alignment, space after, etc.

Male sure you have only one colour in use in your table range.
 
K

Klaus Linke

Jean-Guy Marcil said:
9999999 is usually returned when Word cannot identify a parameter, like
font
size, cell alignment, space after, etc.

Male sure you have only one colour in use in your table range.

It could also be an issue of the number of rows.

Word doesn't even try to retrieve the properties if you have a lot of text
in the Range and simply returns 9999999 (wdUndefined) -- probably because it
would take too much time.
IIRC, the magic limit is 40 paragraphs, though that might not be universal,
and I have never tested in tables.

Regards,
Klaus
 
D

Domseeker

Thanks. I have checked cells and rows ( OK). but the whole table is still not
recognized. I'll stick with the range "oTbl.cell(1,1)..."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top