A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VBA - Find and Replace a character



 
 
Thread Tools Display Modes
  #1  
Old November 19th, 2009, 10:07 PM posted to microsoft.public.powerpoint
Mel
external usenet poster
 
Posts: 89
Default VBA - Find and Replace a character

(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
  #2  
Old November 19th, 2009, 11:46 PM posted to microsoft.public.powerpoint
Shyam Pillai
external usenet poster
 
Posts: 622
Default VBA - Find and Replace a character

Hello,
Take a look at this example and then adapt it to your needs.
http://skp.mvps.org/ppt00025.htm#2

Regards,
Shyam Pillai

Image Importer Wizard: http://skp.mvps.org/iiw.htm


"Mel" wrote in message
...
(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


  #3  
Old November 20th, 2009, 03:31 PM posted to microsoft.public.powerpoint
Mel
external usenet poster
 
Posts: 89
Default VBA - Find and Replace a character

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


On Nov 19, 5:46*pm, "Shyam Pillai" wrote:
Hello,
Take a look at this example and then adapt it to your needs.http://skp.mvps.org/ppt00025.htm#2

Regards,
Shyam Pillai

Image Importer Wizard:http://skp.mvps.org/iiw.htm

"Mel" wrote in message

...

(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


  #4  
Old November 20th, 2009, 06:08 PM posted to microsoft.public.powerpoint
Mel
external usenet poster
 
Posts: 89
Default VBA - Find and Replace a character

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



On Nov 20, 9:31*am, Mel wrote:
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

On Nov 19, 5:46*pm, "Shyam Pillai" wrote:

Hello,
Take a look at this example and then adapt it to your needs.http://skp.mvps.org/ppt00025.htm#2


Regards,
Shyam Pillai


Image Importer Wizard:http://skp.mvps.org/iiw.htm


"Mel" wrote in message


....


(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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.