 |
|
 |
|
Next: How do I make text appear when I 'Mouse Over"..
|
| Author |
Message |
External

Since: Nov 19, 2008 Posts: 1
|
(Msg. 1) Posted: Wed Nov 19, 2008 5:14 pm
Post subject: Text Addition/Removal Macro Archived from groups: microsoft>public>powerpoint (more info?)
|
|
|
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. >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 19, 2008 Posts: 6
|
(Msg. 2) Posted: Wed Nov 19, 2008 5:27 pm
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
Dan,
Take a look at this find and replace routine:
"Dan Hegeman" wrote in message
> 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.
>
> >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 19, 2008 Posts: 6
|
(Msg. 3) Posted: Wed Nov 19, 2008 5:29 pm
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
Dan,
Take a look at this find and replace routine as a start:
[URL="http://skp.mvps.org/ppt00025.htm#2"]http://skp.mvps.org/ppt00025.htm#2[/URL]
Regards,
Shyam Pillai
Animation Carbon: [URL="http://www.animationcarbon.com"]http://www.animationcarbon.com[/URL]
"Dan Hegeman" wrote in message
> 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.
>
> >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 21, 2008 Posts: 2
|
(Msg. 4) Posted: Fri Nov 21, 2008 7:58 am
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
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
"Shyam Pillai" wrote:
> Dan,
> Take a look at this find and replace routine as a start:
> [URL="http://skp.mvps.org/ppt00025.htm#2"]http://skp.mvps.org/ppt00025.htm#2[/URL]
>
>
> Regards,
> Shyam Pillai
>
> Animation Carbon: [URL="http://www.animationcarbon.com"]http://www.animationcarbon.com[/URL]
>
>
>
>
> "Dan Hegeman" wrote in message
>
> > 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.
> >
> >
> >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 19, 2008 Posts: 6
|
(Msg. 5) Posted: Fri Nov 21, 2008 8:54 am
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
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: [URL="http://www.animationcarbon.com"]http://www.animationcarbon.com[/URL]
"Dan Hegeman" wrote in message
> 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
>
> "Shyam Pillai" wrote:
>
>> Dan,
>> Take a look at this find and replace routine as a start:
>> [URL="http://skp.mvps.org/ppt00025.htm#2"]http://skp.mvps.org/ppt00025.htm#2[/URL]
>>
>>
>> Regards,
>> Shyam Pillai
>>
>> Animation Carbon: [URL="http://www.animationcarbon.com"]http://www.animationcarbon.com[/URL]
>>
>>
>>
>>
>> "Dan Hegeman" wrote in message
>>
>> > 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.
>> >
>> >
>> >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 8, 2008 Posts: 108
|
(Msg. 6) Posted: Fri Nov 21, 2008 1:57 pm
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
> 1. Instead of replacing one string with another, is there a way to make
> FindWhat a "variable" and ReplaceWith "newtext variable".
Modify Shyam's code; instead of replacing text with another string, simply
change it to "XYZ" & the original text
Should be enough to change the Case Else part of the ReplaceText function as
follows:
Case Else
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
oShp.TextFrame.TextRange.Text = _
"XYZ" & oShp.TextFrame.TextRange.Text
End If
End If
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: [URL="http://www.pptfaq.com"]www.pptfaq.com[/URL]
PPTools: [URL="http://www.pptools.com"]www.pptools.com[/URL]
================================================ >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 21, 2008 Posts: 2
|
(Msg. 7) Posted: Fri Nov 21, 2008 1:57 pm
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
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?
"Steve Rindsberg" wrote:
>
> > 1. Instead of replacing one string with another, is there a way to make
> > FindWhat a "variable" and ReplaceWith "newtext variable".
>
> Modify Shyam's code; instead of replacing text with another string, simply
> change it to "XYZ" & the original text
>
> Should be enough to change the Case Else part of the ReplaceText function as
> follows:
>
> Case Else
> If oShp.HasTextFrame Then
> If oShp.TextFrame.HasText Then
> oShp.TextFrame.TextRange.Text = _
> "XYZ" & oShp.TextFrame.TextRange.Text
> End If
> End If
>
> -----------------------------------------
> Steve Rindsberg, PPT MVP
> PPT FAQ: [URL="http://www.pptfaq.com"]www.pptfaq.com[/URL]
> PPTools: [URL="http://www.pptools.com"]www.pptools.com[/URL]
> ================================================
>
>
> >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 8, 2008 Posts: 108
|
(Msg. 8) Posted: Fri Nov 21, 2008 6:46 pm
Post subject: Re: Text Addition/Removal Macro Archived from groups: per prev. post (more info?)
|
|
|
In article , Dan Hegeman
wrote:
> 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?
Make the changes below:
>
> "Steve Rindsberg" wrote:
>
> >
> > > 1. Instead of replacing one string with another, is there a way to make
> > > FindWhat a "variable" and ReplaceWith "newtext variable".
> >
> > Modify Shyam's code; instead of replacing text with another string, simply
> > change it to "XYZ" & the original text
> >
> > Should be enough to change the Case Else part of the ReplaceText function as
> > follows:
> >
Add this to the beginning of the function:
Dim x As Long
> > Case Else
> > If oShp.HasTextFrame Then
> > If oShp.TextFrame.HasText Then
With oShp.TextFrame.TextRange
For x = 1 To .Paragraphs.Count
.Paragraphs(x).Text = "SHAZAM! " & .Paragraphs(x).Text
Next
End With
> > oShp.TextFrame.TextRange.Text = _
> > "XYZ" & oShp.TextFrame.TextRange.Text
> > End If
> > End If
> >
> > -----------------------------------------
> > Steve Rindsberg, PPT MVP
> > PPT FAQ: [URL="http://www.pptfaq.com"]www.pptfaq.com[/URL]
> > PPTools: [URL="http://www.pptools.com"]www.pptools.com[/URL]
> > ================================================
> >
> >
> >
>
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: [URL="http://www.pptfaq.com"]www.pptfaq.com[/URL]
PPTools: [URL="http://www.pptools.com"]www.pptools.com[/URL]
================================================ >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 21, 2008 Posts: 1
|
(Msg. 9) Posted: Fri Nov 21, 2008 6:46 pm
Post subject: Re: Text Addition/Removal Macro [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
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!
"Steve Rindsberg" wrote:
> In article , Dan Hegeman
> wrote:
> > 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?
>
>
> Make the changes below:
>
> >
> > "Steve Rindsberg" wrote:
> >
> > >
> > > > 1. Instead of replacing one string with another, is there a way to make
> > > > FindWhat a "variable" and ReplaceWith "newtext variable".
> > >
> > > Modify Shyam's code; instead of replacing text with another string, simply
> > > change it to "XYZ" & the original text
> > >
> > > Should be enough to change the Case Else part of the ReplaceText function as
> > > follows:
> > >
>
> Add this to the beginning of the function:
>
> Dim x As Long
>
> > > Case Else
> > > If oShp.HasTextFrame Then
> > > If oShp.TextFrame.HasText Then
>
> With oShp.TextFrame.TextRange
> For x = 1 To .Paragraphs.Count
> .Paragraphs(x).Text = "SHAZAM! " & .Paragraphs(x).Text
> Next
> End With
>
>
> > > oShp.TextFrame.TextRange.Text = _
> > > "XYZ" & oShp.TextFrame.TextRange.Text
> > > End If
> > > End If
> > >
> > > -----------------------------------------
> > > Steve Rindsberg, PPT MVP
> > > PPT FAQ: www.pptfaq.com
> > > PPTools: www.pptools.com
> > > ================================================
> > >
> > >
> > >
> >
>
> -----------------------------------------
> Steve Rindsberg, PPT MVP
> PPT FAQ: www.pptfaq.com
> PPTools: www.pptools.com
> ================================================
>
>
> >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
External

Since: Nov 22, 2008 Posts: 2
|
(Msg. 10) Posted: Sat Nov 22, 2008 12:25 pm
Post subject: Re: Text Addition/Removal Macro [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> 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.
PPT's VBA Help. yeah. well.
And come to think of it, we should've used "SHYAM!" instead of "SHAZAM!"
Ingrates, the both of us.
But to the problem at hand:
Instead of this:
.Paragraphs(x).Text = "SHAZAM! " & .Paragraphs(x).Text
How about:
If Mid$(.Paragraphs(x).Text, 1, Len("SHAZAM!")) = "SHAZAM!" Then
' don't do anything
Else
' tack on a Shazam
End If
And as a sanity maintenance measure, I'd put the "SHAZAM" text into a constant or
variable and use that in all of the code instead of the literal text.
>
> 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!
>
> "Steve Rindsberg" wrote:
>
> > In article , Dan Hegeman
> > wrote:
> > > 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?
> >
> >
> > Make the changes below:
> >
> > >
> > > "Steve Rindsberg" wrote:
> > >
> > > >
> > > > > 1. Instead of replacing one string with another, is there a way to make
> > > > > FindWhat a "variable" and ReplaceWith "newtext variable".
> > > >
> > > > Modify Shyam's code; instead of replacing text with another string, simply
> > > > change it to "XYZ" & the original text
> > > >
> > > > Should be enough to change the Case Else part of the ReplaceText function as
> > > > follows:
> > > >
> >
> > Add this to the beginning of the function:
> >
> > Dim x As Long
> >
> > > > Case Else
> > > > If oShp.HasTextFrame Then
> > > > If oShp.TextFrame.HasText Then
> >
> > With oShp.TextFrame.TextRange
> > For x = 1 To .Paragraphs.Count
> > .Paragraphs(x).Text = "SHAZAM! " & .Paragraphs(x).Text
> > Next
> > End With
> >
> >
> > > > oShp.TextFrame.TextRange.Text = _
> > > > "XYZ" & oShp.TextFrame.TextRange.Text
> > > > End If
> > > > End If
> > > >
> > > > -----------------------------------------
> > > > Steve Rindsberg, PPT MVP
> > > > PPT FAQ: www.pptfaq.com
> > > > PPTools: www.pptools.com
> > > > ================================================
> > > >
> > > >
> > > >
> > >
> >
> > -----------------------------------------
> > Steve Rindsberg, PPT MVP
> > PPT FAQ: www.pptfaq.com
> > PPTools: www.pptools.com
> > ================================================
> >
> >
> >
>
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================ >> Stay informed about: Text Addition/Removal Macro |
|
| Back to top |
|
 |  |
| Related Topics: | How do I make text appear when I 'Mouse Over" a piece of t.. - How do I make text appear when I 'Mouse Over" a piece of text on a slide. I undertand the Action buttons but I do not want to link to a doc just have a text box appear when they mouse over certain areas of a slide.
Macro - Is Macro in power point is same as in Excel
A macro to call up the SpeakerNotes master in PP - I need a simple PowerPoint macro that will call up the SpeakerNotes master and format the text to bold 16 point. Ken Chant
Power point 2007 macro to move an object - I am trying to work with power point. I have a meter (simple, with a needle in the middle to move left or right). Then, I have a selector with 8 prime function. Each function have 3 sub-functions. Example: Function: Weather. Sub Function: good, bad,...
Macro to udpate and dislpay file path before save? - Hi, I've very new to macros, and really need some help. Does anyone know how to make this macro (from Microsoft's knowlegde base) run automatically before the presentation is saved? Sub UpdatePath() ' Macro to add the path and file name to eac... |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|