Update TextBox at runtime

R

ristmi

OK, here goes. I answered by two previous questions myself shortly
after posting, so let's see if the same thing happens again.

I create a PowerPoint presentation (using VB), and I have the slide I
want to work with. Ultimately, I want to draw a set of (say) 10
TextBoxes, and on top of each of the 10 TextBoxes I want to draw a
shape that has the exact dimensions of the largest (widest) of the 10
TextBoxes.

I create each TextBox, place in the text I want (variable text length
in each TextBox), and then use...

..TextFrame.AutoSize = ppAutoSizeShapeToFitText

.... to adjust the width of each TextBox to fit the text. From this, I
can work out the dimensions of the Shape that I will create on top of
each TextBox.

ppAutoSizeShapeToFitText works just fine when my presentation
(WithWindow) is visible. However, I create my presentation with
"WithWindow = False" because this saves save a lot of time (I'm using a
lot of shapes on each slide). Unfortunately, ppAutoSizeShapeToFitText
then fails to resize the TextBoxes, and therefore I cannot create a
Shape the width of the TextBox with the longest text/string.

The question, finally- how can I make ppAutoSizeShapeToFitText resize
my TextBox when my presentation is not visible?

Thanks
 
R

ristmi

Not really the answer I was looking for, but you can just update the
size with code yourself...

With ActiveWindow.Selection.ShapeRange(1)
.Left = .TextFrame.TextRange.BoundLeft - .TextFrame.MarginLeft
.Top = .TextFrame.TextRange.BoundTop - .TextFrame.MarginTop
.Width = .TextFrame.TextRange.BoundWidth + .TextFrame.MarginLeft +
..TextFrame.MarginRight
.Height = .TextFrame.TextRange.BoundHeight + .TextFrame.MarginTop +
..TextFrame.MarginBottom
' Add this line just to turn the setting on.
.TextFrame.AutoSize = ppAutoSizeShapeToFitText
End With

(code quoted from
http://groups.google.com/group/microsoft.public.powerpoint/msg/dc3746a34d2e516b?hl=en&)
 

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