Creating a textbox during a presentation...

R

ristmi

Hi

I have some VBA code for power point that creates a custom drawing (a
chart) during a slideshow presentation. The chart is created using
lines, shapes and textboxes.

First I create a new slide (I'm producing multiple charts) -
Set newSlide =
ActivePresentation.Slides.Add(ActivePresentation.Slides.Count + 1,
ppLayoutBlank)

Then I start building the chart....

For example, I create a new line (for the axis) with the code -
Set newShape = newSlide.Shapes.AddLine(startLeft, startTop, endLeft,
endTop)

For my blocks, I use custom/freeform shapes, for example -
newSlide.Shapes.BuildFreeform(msoEditingAuto, startLeft, startTop)

Then, and here's the problem, I need to create a set of TextBoxes.
During 'Design Time' I use code like -
newSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0, 10,
10).Select
With ActiveWindow.Selection
.... code to modify text box

Since I cannot use SELECT during run time (i.e. in the presentation),
what is the alternative?

Thank you
 
R

ristmi

Well, there's nothing like posting a question to spur oneself into
action, after all of a few minutes...

All I needed to do was -
set newShape = newSlide.Shapes.AddTextbox(msoTextOrientationHorizontal,
0, 0, 10, 10)

Then I can modify the text of the shape using code such as -
newShape.TextFrame.TextRange..ParagraphFormat.Alignment = ppAlignCenter
etc.
 
E

Echo S

ristmi said:
Well, there's nothing like posting a question to spur oneself into
action, after all of a few minutes...

Ah, yes. That's called Echo's Law. :)
http://tinyurl.com/f78cp
All I needed to do was -
set newShape = newSlide.Shapes.AddTextbox(msoTextOrientationHorizontal,
0, 0, 10, 10)

Then I can modify the text of the shape using code such as -
newShape.TextFrame.TextRange..ParagraphFormat.Alignment = ppAlignCenter
etc.

Glad you got it worked out!
 

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