PowerPoint: Change the text in a text type shape via automation

D

Dale Fye

Office 2003

Please excuse the multi-post, but I'm using Microsofts Discussion Group web
interface, and cannot figure out how to do a cross post.

What is the appropriate property of a textbox type shape to change the text
that appears in the shape, programmatically?

I'm creating a customized charting function, and want to create a legend on
the fly, but need to know how to change the text inside the textbox.

Dale
 
V

vindys

If ActivePresentation.Slides(1).Shapes(1).Type = msoTextBox Then
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "some text"
End If

this will be a simple way to change the text. also u have text inside each
runs and paraformat.
 
J

John Wilson

Are you creating the box with code? If you are using the AddTextBox method
you can use something like

Dim otxtbox As Shape
'values are left,top,width and height
Set otxtbox = ActivePresentation.Slides(1).Shapes _
..AddTextbox(msoTextOrientationHorizontal, 0, 0, 200, 50)
With otxtbox.TextFrame.TextRange
'change these to suit
..Text = "Abcdef"
..Font.Name = "Arial"
..Font.Size = 12
..Font.Color = RGB(100, 100, 0)
End With
Set otxtbox = Nothing

--
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
D

Dale Fye

Thanks, both of you.

Your responses were right on the mark. Never would have thought about
digging quite so deep as TextFrame.TextRange.Text
--


email address is invalid
Please reply to newsgroup only.
 

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