PowerPoint VBA and WordArt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to use VBA to add a WordArt shape and I want the WordArt shape to
always be centered horizontally but be in a specific location vertically.
What is the calculation or means to figure this out based on the number of
characters in the text that will be displayed in the WordArt shape?
Thanks!!!
 
I need to use VBA to add a WordArt shape and I want the WordArt shape to
always be centered horizontally but be in a specific location vertically.
What is the calculation or means to figure this out based on the number of
characters in the text that will be displayed in the WordArt shape?

I don't think that'll work. Most fonts are proportional, meaning that e.g a
"w" is considerably wider than an "i". You'd need the width information for
each character in the font and that's just the beginning of the complications.
Different WordArt shapes may distort the text, which'd throw your calculations
off, even if you did have all the width information. Then there's kerning ...

But if you're adding word via code, you can get a reference to the shape and
easily find out its height and width properties.
 
Good morning Steve,

Makes sense.....

Okay, let me work through this.....

I could still have my wordart place holders already setup in the slide.
Then, part of my coding of updating those place holders I would add new
wordart with the updated with "new" text and capture the settings....correct?
If so, what's a good way of capturing that information?

Anytime that you add a new wordart item does it always center on the slide
vertically and horizontally?

Thanks!!
bl
 
What Steve said and ...

If you are working in Normal/Edit view, you can use something like this
to add the WordArt and then align it center. The msoTrue parameter in the
Align method indicates that the alignment will be relative to a slide.

ActiveWindow.Selection.SlideRange.Shapes.AddTextEffect _
(msoTextEffect10, "Testing 1 2 3", "Arial Black", 36#, _
msoFalse, msoFalse, 5, 5).Select
ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, msoTrue


--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
Hello David...

To give a little more information..... all my placeholders are rotated 90
degrees. Why? I am using the new Dell flat wide screen monitors that rotate
but my video card does not support the rotation. Thus, I having to create a
slide that is 90 degrees. Currently I am using text boxes but I can't format
the text like need to do that Word Art offers.

Is there a better way?

Thanks!
bl
 
I'm not sure I have anything to offer you. Perhaps, someone else has some
ideas.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
You may use a regular text for this, if it's in an object. An Example:

This example adds an oval containing text to slide one in the active
presentation and rotates the oval and the text 45 degrees. The parent object
for the text frame is the Shape object that contains the text.

Set myShapes = ActivePresentation.Slides(1).Shapes
With myShapes.AddShape(Type:=msoShapeOval, Left:=50, _
Top:=50, Width:=300, Height:=150).TextFrame
.TextRange.Text = "Test text"
.Parent.Rotation = 45
End With



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com
 
Good morning Steve,

Makes sense.....

Okay, let me work through this.....

I could still have my wordart place holders already setup in the slide.
Then, part of my coding of updating those place holders I would add new
wordart with the updated with "new" text and capture the settings....correct?
If so, what's a good way of capturing that information?

Quote the code you use to add the word art and we'll go from there with specific
changes that suit the method you're using.
Anytime that you add a new wordart item does it always center on the slide
vertically and horizontally?

It seems to but I use it so seldom that if I were you, I wouldn't act on my advice.
<g>

Beside, you mentioned putting it placeholders ... if you do that, it'll appear
wherever the placeholder is.
 
Thanks Austin,

That is currently what I am doing now. I kinda want my cake and eat too....
Meaning, I want and like the functionality of a text box but want to format
my fonts like the wordart. Thus, the text boxes span the width of the slide
and I have my text centered inside. Of course with the good ol' wordart it
wants to fill the entire area with my text making look distorted and not
consistant.

With that being said...... would you think it would be possible to have the
wordart placeholders filled with spaces and then when the code runs it would
determine the length of the text and add spaces to left and right to keep the
text a consistant size and centered?

Thanks for listening!

bl
 
Back
Top