Need VBA Code for Searching & Replacing within Grouped Objects

C

Cathy

I have a PowerPoint macro that searches and replaces a lot of terminology
within a presentation to make it company compliant. The macro works fine on
text slides and objects that have text in them that are not grouped,
however, it cannot enter the grouped objects and replace text where
necessary.

If anyone knows how to write this in VBA, I would be very grateful to hear
from them. I am using PowerPoint 2002.

Thank you.
 
D

David M. Marcovitz

I'm not sure, but I think you will have to ungroup the objects first with something like

ActivePresentation.Slides(1).Shapes("Group 6").Ungrou
MsgBox "This is where you can play with the text
With ActivePresentation.Slides(1).Shapes.Range().Regrou

If the shapes don't need to end up grouped, you can skip the last line. Keep in mind that Regroup will regroup the last set of ungrouped objects, so you can't do a bunch of ungroups and then regroup and expect it to work

I hope this helps

--Davi

David M. Marcovit
Author of _Powerful PowerPoint for Educators
http://www.loyola.edu/education/PowerfulPowerPoint

----- Cathy wrote: ----

I have a PowerPoint macro that searches and replaces a lot of terminolog
within a presentation to make it company compliant. The macro works fine o
text slides and objects that have text in them that are not grouped
however, it cannot enter the grouped objects and replace text wher
necessary

If anyone knows how to write this in VBA, I would be very grateful to hea
from them. I am using PowerPoint 2002

Thank you.
 
D

David M. Marcovitz

It's not real intuitive. <g>

And it gets ugly if you decide you want to handle groups within groups
within .. yeah, well. You get the idea.

It's particularly tough finding things like this on the Mac version where
you can't just press . and have all the options pop up. Scouring the
help files is much harder.

--David
--
David M. Marcovitz, Ph.D.
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
C

Cathy

Steve,

Thank you so much for responding to my request for help. I think what you
wrote will help us a lot. The way my macro is laid out is quite involved,
so we won't be able to do it exactly the way you have it written, but will
should be able to use most of it. Again, I can't thank you enough.

Cathy
 
C

Cathy

Hi David,

Thank you for your help. I think the way that Steve wrote this out is what
we will try to use, so we don't have to ungroup and regroup everything.
Again, thank you for taking the time to respond.

Cathy
 
B

Bill Dilworth

Just as a head's up, using this method would cause the loss of any
animations attached to the group.


David M. Marcovitz said:
I'm not sure, but I think you will have to ungroup the objects first with something like:

ActivePresentation.Slides(1).Shapes("Group 6").Ungroup
MsgBox "This is where you can play with the text"
With ActivePresentation.Slides(1).Shapes.Range().Regroup

If the shapes don't need to end up grouped, you can skip the last line.
Keep in mind that Regroup will regroup the last set of ungrouped objects, so
you can't do a bunch of ungroups and then regroup and expect it to work.
 
B

Brian Reilly, MS MVP

It's not real intuitive. <g>

Nor is Steve, which is why, most of the time, he is so good. Other
times, I just gotta think he's being intuitive, or just lost his mind.
Your guess?

Brian Reilly, PowerPoint MVP

who doesn't actually have a mind to lose. Told by a friend of my wife
a long time ago, that it'd be a terrible thing to lose, but didn't
listen to either of them. Should have.
 
C

Cathy

Hi Shyam,

Thank you so much for responding to this message. The code on your site was
really helpful. Following what you had, we were able to get our macro to
work within groups. You were right about it getting messy when you need to
handle groups within groups, because that's what we ended up having to do.

This was my first time posting a question on this site and everyone was
extremely helpful and responsive. Thank you again!!

Cathy
Shyam Pillai said:
And it gets ugly if you decide you want to handle groups within groups
within
http://www.mvps.org/skp/ppt00025.htm#2 : )

Regards
Shyam


 

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