VBA Find will not return NOTHING

G

Guest

An add-in I've created worked fine in PowerPoint 2003, but gave an error in
PowerPoint 2007, B2TR. The cause appears to be that Find does not return
NOTHING if the search string is not found. Here's the example from Help:
Set txtRng = shp.TextFrame.TextRange
Set foundText = txtRng.Find(FindWhat:="CompanyX")
Do While Not (foundText Is Nothing)
With foundText
.Font.Bold = True
Set foundText = _
txtRng.Find(FindWhat:="CompanyX", _
After:=.Start + .Length - 1)
End With
Loop

I got my code to work by replacing
Do While Not (foundText Is Nothing)
with
Do While Not (foundText = "")
Looks like this is a bug in VBA: when the search text is not found, the
variable is set to "", rather than NOTHING.

Chris

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...f-2a55f89495cc&dg=microsoft.public.powerpoint
 

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