Text Addition/Removal Macro

D

Dan Hegeman

Wow, you guys are smart so I'm sure this question will be a piece of cake.

I'm trying to write a ppt macro (Windows, Powerpoint 2003) to automatically
step through all pages of the document, examine all text fields (titles, text
boxes, all bullets in a list, text in tables, etc.), and if a character
string isn't present, add it at the beginning of that field. The format
would need to match the existing text too.

I had asked for help with this around the office with some of the CS folks
but no one knew VBA.

So I tried to solve this myself - I wrote a basic macro to add extra text to
a bulleted list, but the problems are:
-the object names change across slides ("Rectangle 6" vs. "Rectangle 10", so
I would need some kind of "look at all of the objects" command)
-all of the text is added to the first bullet, instead of being distributed
evenly among bullets.

As much as I would like to teach myself VBA, I feel like it would take me a
long time to progress to the point to do this myself. But maybe you can
point me in the right direction for learning modules that cater to this.
 
D

Dan Hegeman

Thanks, that helps a bunch. Good stuff! Some lingering questions:
1. Instead of replacing one string with another, is there a way to make
FindWhat a "variable" and ReplaceWith "newtext variable". In other words,
I'm not just replacing, but rather adding text to the very front of the
string (or very end).
2. Why did you start your case numbers at 19? Just because?
Thanks
 
S

Shyam Pillai

1. You can still do this Find XYZ and Replace it with ABCXYZ it is a find
and replace operation.
2. Table, groups and diagrams require special handling that's why they are
on top.

Regards,
Shyam Pillai

Animation Carbon: http://www.animationcarbon.com
 
D

Dan Hegeman

Yes, that's almost exactly what I'd like! This works like a charm, except it
won't step through a bulleted list and apply the change to every bullet; it
only does the first bullet. How can this be done?
 
D

Dan Hegeman

Yeah, that's what I was able to figure out on my own after a few hours,
before you responded. Except I used:
..Paragraphs(x).InsertBefore "SHAZAM"
which yields the same results as using the '&' operator.

But what if "SHAZAM" is already in the line, I don't want to add it again.
I'm trying to use the Find function (using the example provided in the MS VB
Help Documentation included in PPT) but it's not working.

The logic of the program is
for a text object
if "SHAZAM" is already included in a line, move on to the next line
else insert "SHAZAM"

the Find function uses a Do While Not conditional which doesn't make sense
to me.

Anyway, you've already helped a bunch so I don't expect much more. Thanks!
 

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