Word 2007's Find command no longer able to find Style Separators

W

wordyOne

Word seems to have unexpectedly changed in its ability to find Style
Separators.

In years past (and versions past), you could insert a Style Separator, then
locate it later using Word's find dialog by searching for text "^p" with font
Hidden.

It is, after all, basically just a paragraph mark, and it's font attribute
is Hidden. But all of the sudden--not sure if it's just something that
started with Word 2007 SP2--it is no longer found with these parameters.

This came as quite a surprise as several macros I use to find Style
Separators just stopped working. Does anyone have an inside scoop into
changes that may have been made recently to the behavior of the Find dialog
with respect to Style Separator paragraphs? And if so, why the decision to
make this change was made by Microsoft?

Thanks
 
S

Suzanne S. Barnhill

Are you sure that you were actually using style separators and not Hidden
paragraph marks when this Find worked for you?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
J

Jay Freedman

Word seems to have unexpectedly changed in its ability to find Style
Separators.

In years past (and versions past), you could insert a Style Separator, then
locate it later using Word's find dialog by searching for text "^p" with font
Hidden.

It is, after all, basically just a paragraph mark, and it's font attribute
is Hidden. But all of the sudden--not sure if it's just something that
started with Word 2007 SP2--it is no longer found with these parameters.

This came as quite a surprise as several macros I use to find Style
Separators just stopped working. Does anyone have an inside scoop into
changes that may have been made recently to the behavior of the Find dialog
with respect to Style Separator paragraphs? And if so, why the decision to
make this change was made by Microsoft?

Thanks

As far as I can tell, nothing has changed in this regard between Word
2003 and Word 2007. If nonprinting characters (or just hidden text)
are displayed, the search you described will find the style separator
in either version. If nonprinting characters (or just hidden text) are
not displayed, then the search finds nothing.

In VBA code, you can find hidden characters including style separators
by using the .Find member of a Range object instead of that of the
Selection object, and setting the Range object's
..TextRetrievalMode.IncludeHiddenText property to True:

Sub demo1()
Dim oRg As Range
Set oRg = Selection.Range
oRg.End = ActiveDocument.Range.End
oRg.TextRetrievalMode.IncludeHiddenText = True
With oRg.Find
.Format = True
.Font.Hidden = True
.Text = "^p"
If .Execute Then
ActiveWindow.View.ShowHiddenText = True
oRg.Select
End If
End With
End Sub

The Range object is necessary because the Selection object doesn't
have a .TextRetrievalMode member.

Note that the .ShowHiddenText turns on the Hidden Text item in Office
button > Word Options > Display, independently of the "Show all
formatting marks" which is tied to the ¶ button on the ribbon -- but
it will show all hidden text, not just the style separators.
 
W

wordyOne

Thanks for your reply. Yes, it is definitely Word's style separator - I used
the InsertStyleSeparator command under All Commands. I have also
double-checked jsut to be sure, and indeed on my Word 2003 SP3 PC, I can do a
Find command for ^p and Hidden and the style separator is definitely found.
My macros have worked since the inception of the Style Separtor feature, but
something definitely changed which broke the ability to find them with Word
2007.
 
W

wordyOne

Thanks Jay. I have made sure that display of Hidden text is definitely turned
on when running my macros. Whether via the Find command in VBA or through
Word's UI, the ^p with Hidden checked no longer finds Word's style
separators. I have confirmed that the exact same steps always worked (and
still do) for finding Style Separators in Word 2003.
 
J

Jay Freedman

The code I posted before works for me in Word 2007 on two different
computers. Does it not work for you? (One note: Because of the way the range
is defined in the macro, the cursor does need to be placed closer to the
start of the document than the style separator before running the macro in
order to find the separator.)

Jay
 
W

wordyOne

I have pasted your VBA code into my IDE and it just doesn't work for me :(.

Code aside, if you use the Find dialog in Word 2003 and you look for "^p"
and Hidden do you find the style separators? And those exact steps in Word
2007 are they found?

The thing that I just can't get my head around is I had rock solid code
which I have been using to perform this operation for the last 5 years and it
suddenly stopped working. I am beginning to believe this is related to my
particular build of Word 2007 ~ I am using Word 2007 SP2. But for what it's
worth, I tried the same steps in 2010 and it looks like we have the same
problem.

I can work around it, but it's an inconvenience and love to know Microsoft's
reason for why it changed.
 
G

Graham Mayor

Jay's code works for me too.

As for searching for hidden text, the search function will only find hidden
text where hidden text is displayed. This applies equally to Word 2003 and
2007. I don't recall this ever being different?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
W

wordyOne

Hi Graham,
Could you try something for me, just as a quick test of the Find behavior in
Word's front end? Maybe I'm imagining this but I'm pretty sure it's changed.
In Word 2003, insert a Style Separator. Then (with Hidden text showing), use
the Find dialog to search for "^p", along with Font = Hidden checked. And
then using those same steps in a document you create in Word 2007 SP2, does
the Find succeed?
Thanks!
PS - I noticed I somehow accidentally posted this to the DocManagement
subgroup - obviously this is more of a general Word question. Sorry it is in
the wrong place.
 
G

Graham Mayor

It is not found in either Word version unless hidden text is displayed.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
W

wordyOne

I hear what you're saying and not to beat a dead horse, but did you literally
go though the following steps in Word 2007 SP2?

1. Go to Customize, add Style Separator command to your QAT (via the
'Commands Not In Ribbon' list)
2. Turn on viewing of hidden text.
3. Insert some text, and then add a style separator in the document.
4. Go to the top of the document.
5. Use the Find command (either through VBA or the Word UI - doesn't matter).
Enter ^p for the text to find, and ensure that Format is set as Hidden.

I have tried this on several different machines and the same result: It is
not found. The exact same steps in Word 2003 have always worked: the style
separator character is found. Am I seriously the only person who is
experiencing this?
 
J

Jay Freedman

I hear what you're saying and not to beat a dead horse, but did you literally
go though the following steps in Word 2007 SP2?

1. Go to Customize, add Style Separator command to your QAT (via the
'Commands Not In Ribbon' list)
2. Turn on viewing of hidden text.
3. Insert some text, and then add a style separator in the document.
4. Go to the top of the document.
5. Use the Find command (either through VBA or the Word UI - doesn't matter).
Enter ^p for the text to find, and ensure that Format is set as Hidden.

I have tried this on several different machines and the same result: It is
not found. The exact same steps in Word 2003 have always worked: the style
separator character is found. Am I seriously the only person who is
experiencing this?

Yes, I did literally go through those steps. The style separator was
found in Word 2007 on two computers, one running Windows XP SP2 and
the other running Windows 7 Ultimate x64 (although Office is installed
there as a 32-bit application).

Now I've had a chance to try it on a third computer, with Word 2007
running on Windows 7 32-bit, and the style separator is *not* found
there. I don't know what causes the difference. Typically, oddities
like this are caused by add-ins. The 32-bit computer doesn't have any
add-ins that aren't on the 64-bit machine, and in fact the latter has
more add-ins that aren't on the 32-bit machine.

I'll get back to you if I find out anything else.
 
W

wordyOne

Thank you so much for the time you spent looking at this. I was beginning to
think I was crazy.

I did try this on a machine with no add-ins and still have the same result,
so it is happening across the board on all Word 2007 SP2 PCs I've tested this
on. It also is the case in the Word 2010 beta (at least, for me it is).

I am beginning to wonder if it's related to one of the recent Windows
Updates that may have impacted Office 2007. This may explain why some of us
are seeing it and others are not.
 
G

Graham Mayor

Yes - I followed your instructions and as I said, it works when hidden text
is displayed, and not when it isn't.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
W

wordyOne

Just to follow up, I have reported this problem to Microsoft, and it is
confirmed to be broken in the latest build(s) of Word and Word 2010. The
issue has been passed on to the Word engineers.

The reason that some people could not reproduce seems to be related to the
build number of Word 2007. Earlier build numbers apparently do not exhibit
the problem, so it might coincide with some recent Windows or Office SP2
updates.
 

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