Re: Powerpoint 2004 Search and replace
Re: Powerpoint 2004 Search and replace
- Subject: Re: Powerpoint 2004 Search and replace
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 12 Aug 2005 14:20:29 -0700
- Thread-topic: Powerpoint 2004 Search and replace
Title: Re: Powerpoint 2004 Search and replace
On 8/12/05 11:54 AM, "Dan Doughtie" <email@hidden> wrote:
Can anyone jump start me to simply do a text search and replace in Powerpoint. I have a standard template that we use in a hallway display running in the reception area (got a 23” Apple display on wall mount and a Mac Mini hiding in the ceiling driving it). It says what events are going on today, has pithy sayings and such. Our main display is in Keynote which I’m struggling with the XML search and replace to automate the daily display. But that is another story.
The other display is maintained by friends using PCs so I want them entering info into a Filemaker DB then a daily Applescript will pull the data out and update the text (replace “insertDate” with “Tuesday, August 9, 2005” etc.) then run the show.
All of that is easy up to the point of searching and replacing text. I’m pouring over the Powerpoint scritping resource guide now and not finding the smoking gun.
!! They seem to have left this out! I'll report it immediately. From the look of the VBA Object Model there should be the same sort of Find and Replace as in Excel (simpler than in Word). In the meantime, you should still be able to do it using 'do Visual Basic' (as in PPT X), and it isn't too awkward as long as you don't need any result returned. Adapting the example given in the VB Editor Help to Applescript:
This example [is supposed to] replace every whole-word occurrence of "CompanyX" in the active presentation with "CompanyY."
tell app "PowerPoint"
do Visual Basic "
For Each sld In Application.ActivePresentation.Slides
For Each shp In sld.Shapes
shp.TextFrame.TextRange.Replace FindWhat:="CompanyX", _
ReplaceWhat:=\"CompanyY\", WholeWords:=True
Next shp
Next sld
"
end tell
However, testing just now, i see that it only replaces the first instance in each text frame. The same thing happens in VBA. (I'll report that too, but if the bug is also in VBA in PPT Windows and goes back several versions, less chance of getting it fixed.) You'd have to add some more code to keep looping through each TextRange. Or I'll find out if there's a better workaround available.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden