Replace Text in Only One Slide?

  • Thread starter Thread starter nillaster
  • Start date Start date
N

nillaster

Dear All,

I know that PowerPoint lets you find and replace a text string one
occurrence at a time. There is also a "replace all" function that will
replace all occurrences of a text string. However, is it possible to
replace all occurrences on one slide only? This would speed up my work
considerably.

Thank you,

Jacob
 
You can with vba

Sub ReplaceText()

Dim strchange As String
Dim strto As String
Dim fromslide As Integer
Dim toslide As Integer
Dim n As Integer
Dim oSld As Slide
Dim oShp As Shape
Dim oTxtRng As TextRange
Dim oTmpRng As TextRange


strchange = InputBox("change")
strto = InputBox("to")
fromslide = InputBox("From slide")
toslide = InputBox("To slide")

For n = fromslide To toslide
Set oSld = Application.ActivePresentation.Slides(n)

For Each oShp In oSld.Shapes
Set oTxtRng = oShp.TextFrame.TextRange
Set oTmpRng = oTxtRng.Replace(FindWhat:=strchange, _
Replacewhat:=strto, WholeWords:=True)
Do While Not oTmpRng Is Nothing
Set oTxtRng = oTxtRng.Characters(oTmpRng.Start + oTmpRng.Length, _
oTxtRng.Length)
Set oTmpRng = oTxtRng.Replace(FindWhat:=strchange, _
Replacewhat:=strto, WholeWords:=True)
Loop
Next oShp
Next n
End Sub
--
If you dont know how to use vba see here:http://www.pptfaq.com/FAQ00033.htm

Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist
http://www.technologytrish.co.uk/ppttipshome.html
 
Thank you John, but the answer is useless. It means that what you can do in WORD, you can't do in PowerPoint; yet another indication that the two groups just don't talk to each other. All we need is "change in selection". Can you as a Certified Office Specialist at least push to getting the good features of one program included in all others?

Why useless? ... by the time you have run the VBA script, you could have done it by hand. Jacobs's request was a perfectly normal, sensible request. It is something I have missed for years, have written to Microsoft about it, but you never hear anything, not even an email telling me why my requests are sometime good and sometimes stupid.
 
Back
Top