(WholeWords:=True) in PPT 2003 is not the same as in PPT 2000

J

JS

Hi All:
I've used a Find&Replace string macro in PPT 2000 for years now without a
problem, but when running PPT 2003 it acts differently. The core of the
macro is:

Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString,
Replacewhat:=ReplaceString, _
MatchCase:=True,
WholeWords:=True)

No problems with PPT 2000, but with 2003 ONLY whole words get replaced. OK,
so I modified my code to be:

If InStr(FindString, " ") > 0 Then ' Is there a space in the Find
string?
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString,
Replacewhat:=ReplaceString, _
MatchCase:=True)
Else
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString,
Replacewhat:=ReplaceString, _
MatchCase:=True,
WholeWords:=True)
End If

However, if FindString contains other characters (e.g.: ",.;/?:><~^.....etc)
this does not work (what is the WholeWords rule?)
Also, VBA's help says that WholeWords:= can be msoTriState as below:
-------------------------
MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse Default.
msoTriStateMixed
msoTriStateToggle
msoTrue Find only whole words, and not parts of larger words.
-------------------------
However, I've searched (I believe) high & low for more info on what each of
these options do, but without luck. Could someone please help me out on this
subject?

Thanks in advance, JS
 
J

JS

Hi John:
Thank you for your help - good idea to use "Words.Count" to test Findstring.
However, I need to test FindString for Words.Count (and not oTmpRng), I
tried:

Dim TestTxtRng as TextRange
....
TestTxtRng.Text = FindString ' assign text to a textrange variable
If TestTxtRng.Words.Count > 1 Then ...

But this doesn't work because TestTxtRng is Nothing (TestTxtRng.Text =
FindString doesn't work - I also tried Set TestTxtRng = FindString, Set
TestTxtRng.Text = FindString, TestTxtRng = FindString) but nothing works.
Can I not define a TextRange variable and set text to it to use the Words
method?

Again thanks for your help.
Rgds, JS
 
S

Shyam Pillai

Hi JS,
If you want to make use to the properties associated with a text range then
create a dummy textbox and get a reference to it's textrange and then
manipulate it. By itself you cannot instantiate a textrange.

--
Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com
 

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