OK folks, here’s my problem: I have a UserForm with a multiselect listbox that checks items according to whether the font.hidden property is true (-1) or false (0) for certain bookmarks in the document. I’m getting funny behaviour – for some bookmarks, the code is returning neither -1 nor 0, but 9999999. I’m sure I’ve read about something like this with some other attribute somewhere. I’m (pretty) sure the range within the bookmark won’t ever be mixed “some hidden & some not”, so what’s going on here? If I try to check for 9999999 and set it to -1 when it’s found, will that work?
The range within each bookmark is some rows of a table, if this helps (code does seem to work fine on plain ol’ paragraph text); oh, and the first cell in each row is formatted with a style that has outline numbering, too.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
font.hidden property, tables and code (2000)
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » font.hidden property, tables and code (2000)
- This topic has 8 replies, 4 voices, and was last updated 21 years, 11 months ago.
AuthorTopicWSDaveW
AskWoody LoungerJuly 4, 2003 at 7:27 am #390022Viewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerJuly 4, 2003 at 8:03 am #691142Word is not able to determine many formatting properties of a range if that range contains 50 paragraphs or more, so it returns wdUndefined (9999999). This return value only implies that the range contains a mixture of settings if the range is small enough; for large ranges you can’t draw any conclusion from the return value wdUndefined.
So my guess is that “some rows of a table” contain 50 paragraphs or more.
-
WSDaveW
AskWoody LoungerJuly 4, 2003 at 8:41 am #691148Aha; thanks HansV, I didn’t know that.
Yes, I’ve checked the paragraphs.count for each of the bookmarked ranges in the table, and – you’re right – the ones that give trouble have 70 paragraphs in them.
So perhaps what I need to do is *not* have a bookmark that encompasses the whole range to be considered, but one that marks the start, another that marks the end, and have the code just ask about the .hidden property of the starting bookmark, then work with a range that’s defined as eveything between the two?
Heck: thinking as I type, since the first row of each range (and only the first – so at maximum 3 paragraphs, one for each cell in that row) is formatted with a specific style, maybe I should find some way to scrap the bookmarks altogether and identify the ranges according to style, and determine the .hidden property as it’s applied to each occurrence of that style. Hmm… -
WSjscher2000
AskWoody Lounger -
WSDaveW
AskWoody LoungerJuly 7, 2003 at 7:03 am #691642Yes; thanks to you both for these inputs. I think I’ve got a working solution now: I’ve added a second column to the listbox, and put in it the row number where the specified style occurs. So if the style is on rows 1, 12, and 22 (for example) the listbox has items:
blah blah blah | 1
more blah blah | 12
yet more blah | 22. (etc.)
…Then according to whether the item is checked or not I can set rows 1-11, 12-21 or 22-.count as hidden or not hidden.
Because I’m looking at the styles now, this will still work if users add their own “sections” to the table (which it didn’t when I was relying on bookmarks). -
WSDaveW
AskWoody LoungerJuly 16, 2003 at 9:47 pm #694024(Edited by jscher2000 on 16-Jul-03 15:47.
and
markup added around code snippet to preserve indenting.)
Hi guys:
Though the code for applying/retrieving the hidden property is now sorted, after a couple of days not working with the document I’ve now gone back in and found that populating the listbox in the first place is running unbelievably slowly.
Here’s an idea of the structure of the table, then I’ll show the code I’ve got populating the listbox: can anybody see how I might make it run *way* faster?
Table has 3 columns. All the text in cols 2 and 3 is formatted with a style called “response”. In the first column, some rows have text in “Matrix 1” style (these are ‘section headings’ within the table), others have text in “Matrix 2” style (these are items under the headings). Matrix 1 and Matrix 2 styles are outline numbered (1, 2, 3 for Matrix 1; 1.1, 1.2 etc for Matrix 2).
First part of the code for populating the listbox (slow running part):Dim iRow As Row, i As Integer, j As Integer, aRange As Range i = 1 j = 1 With ActiveDocument.Tables(1) For Each iRow In .Rows Set aRange = iRow.Cells(1).Range aRange.TextRetrievalMode.IncludeHiddenText = True If aRange.Paragraphs(1).Style = "matrix h1" Then LstSections.AddItem Left(aRange.Paragraphs(1).Range.Text, _ Len(aRange.Paragraphs(1).Range.Text) - 2) LstSections.List(j - 1, 1) = i j = j + 1 End If i = i + 1 Next iRow '(more code to SELECT items in the list if the corresponding part ' of the table is not formatted as hidden text, then: ) End With
(Note: I’m chopping off the last two characters in each range because it’s in table cells and I don’t want the para mark or cell division character, etc.)
-
WSHansV
AskWoody LoungerJuly 16, 2003 at 4:15 pm #694096I don’t have specific recommendations, but perhaps you can profit from the tips in Maximising the performance of Word tables on the Word MVP site. The second part is about handling tables in code.
According to this article, the fastest way to process the cells of a table is to select the table and loop through its cells:
Dim oCell As Cell
ActiveDocument.Tables(1).Select
For Each oCell In Selection.Cells
…
Next oCell -
WSDaveW
AskWoody LoungerJuly 17, 2003 at 7:25 am #694272Thanks HansV, I’ve printed off Dave Rado’s article (I’ve found his articles to be v. useful in the past), and it looks like there’s stuff I can play with here that should increase speed. There’s certainly a suggestion that if I select a cell in column 1, then select the column, and work with the cells in the selection, that should be faster. I’ll try some of these things out and post an update when I see what happens!
(Unfortunately the best time for me to concentrate on this sort of stuff is on my machine at home – when *anything* runs pretty fast… but then I have to bring it all back in to work, whereupon I find out what’s genuinely fast and what isn’t!!) -
WSKlaus Linke
AskWoody LoungerJuly 17, 2003 at 3:14 pm #694458Don’t know if it is in Dave Rado’s article, but you can get the whole text from a table into a string in one fell swoop:
myString=ActiveDocument.Tables(1).Range.TextYou’d have end-of-cell-markers Chr(13)&Chr(7) after each cell, and additional ones at the end of each row.
If your table is uniform (no merged/split cells), you can easily retrieve the contents of the cells (for example by splitting the string up with Split).
Klaus
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
LibreOffice 25.8. No Windows 7, 8/8.1, x86
by
Alex5723
2 hours, 39 minutes ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
18 hours, 35 minutes ago -
June KB5060842 update broke DHCP server service
by
Alex5723
17 hours, 6 minutes ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
21 hours, 9 minutes ago -
Excessive security alerts
by
WSSebastian42
16 hours, 50 minutes ago -
* CrystalDiskMark may shorten SSD/USB Memory life
by
Alex5723
1 day, 6 hours ago -
Ben’s excellent adventure with Linux
by
Ben Myers
24 minutes ago -
Seconds are back in Windows 10!
by
Susan Bradley
17 hours, 46 minutes ago -
WebBrowserPassView — Take inventory of your stored passwords
by
Deanna McElveen
19 minutes ago -
OS news from WWDC 2025
by
Will Fastie
3 hours, 54 minutes ago -
Need help with graphics…
by
WSBatBytes
1 hour, 56 minutes ago -
AMD : Out of Bounds (OOB) read vulnerability in TPM 2.0 CVE-2025-2884
by
Alex5723
1 day, 22 hours ago -
Totally remove or disable BitLocker
by
CWBillow
21 hours, 13 minutes ago -
Windows 10 gets 6 years of ESU?
by
n0ads
1 day ago -
Apple, Google stores still offer China-based VPNs, report says
by
Nibbled To Death By Ducks
2 days, 8 hours ago -
Search Forums only bring up my posts?
by
Deo
3 hours, 18 minutes ago -
Windows Spotlight broken on Enterprise and Pro for Workstations?
by
steeviebops
2 days, 20 hours ago -
Denmark wants to dump Microsoft for Linux + LibreOffice
by
Alex5723
2 days, 13 hours ago -
How to get Microsoft Defender to honor Group Policy Setting
by
Ralph
2 days, 21 hours ago -
Apple : Paragon’s iOS Mercenary Spyware Finds Journalists Target
by
Alex5723
3 days, 7 hours ago -
Music : The Rose Room – It’s Been A Long, Long Time album
by
Alex5723
3 days, 8 hours ago -
Disengage Bitlocker
by
CWBillow
2 days, 22 hours ago -
Mac Mini M2 Service Program for No Power Issue
by
Alex5723
3 days, 10 hours ago -
New Win 11 Pro Geekom Setup questions
by
Deo
3 hours, 22 minutes ago -
Windows 11 Insider Preview build 26200.5651 released to DEV
by
joep517
3 days, 17 hours ago -
Windows 11 Insider Preview build 26120.4441 (24H2) released to BETA
by
joep517
3 days, 17 hours ago -
iOS 26,, MacOS 26 : Create your own AI chatbot
by
Alex5723
3 days, 21 hours ago -
New PC transfer program recommendations?
by
DaveBoston
2 days, 2 hours ago -
Windows 11 Insider Preview Build 22631.5545 (23H2) released to Release Preview
by
joep517
4 days, 1 hour ago -
Windows 10 Build 19045.6029 (22H2) to Release Preview Channel
by
joep517
4 days, 1 hour ago
Recent blog posts
- Ben’s excellent adventure with Linux
- Seconds are back in Windows 10!
- WebBrowserPassView — Take inventory of your stored passwords
- OS news from WWDC 2025
- Best tools for upgrading a Windows 10 to an 11
- Master patch listing for June 10, 2025
- 24H2 may not be offered June updates
- June 2025 updates are out
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.