VBA - Find and Replace a character

  • Thread starter Thread starter Mel
  • Start date Start date
M

Mel

(PPT 2003 and sometimes 2007)

Hi, again.

Within every object on each of my slides, I want to replace Chr$(8482)
for Chr$(9674). I also want it then superscripted, and for it to
change characters in charts and wordart as well. But I'm stuck.
Everything I'm trying is just turning into a mess. Can anyone help
with this?

Thanks a lot,
Melina
 
Thanks. But I can't figure out how can I make this search and replace
a character number such as replace Chr$(8482) with Chr$(9674). Can
this be done?

Thanks,
Melina
 
Can PPT not negotiate such high character numbers? My code works fine
with smaller character numbers. I'm just trying to replace the trade
mark symbol with the lozenge symbol. The numbers I'm using is what PPT
showed in recording a macro of inserting the symbols, so it'd appear
PPT recognizes the character numbers. What am I doing wrong? Do I need
to do something special with such high character numbers? This is what
I'm using...

Sub ReplaceChrs()

Dim oSld As Slide
Dim oShp As Shape
Dim oTxtRng As TextRange
Dim oTmpRng As TextRange
Dim SearchFor As String
Dim ReplaceWith As String
SearchFor = Chr(8482)
ReplaceWith = Chr(9674)

For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
Set oTxtRng = oShp.TextFrame.TextRange
Set oTmpRng = oTxtRng.Replace(FindWhat:=SearchFor, _
Replacewhat:=ReplaceWith, WholeWords:=False)
Do While Not oTmpRng Is Nothing
Set oTxtRng = oTxtRng.Characters(oTmpRng.Start + oTmpRng.Length,
_
oTxtRng.Length)
Set oTmpRng = oTxtRng.Replace(FindWhat:=SearchFor, _
Replacewhat:=ReplaceWith, WholeWords:=False)
Loop
End If
End If
Next oShp
Next oSld

End Sub
 
THAT DID IT!!!

Ok, so can you enlighten me as to what's the difference between the
two (besides one worked and the other didn't.)

Thanks so much, Steve!!!

-Melina
 
Back
Top