AutoSize not working?

O

Olaf Rabbachin

Hi folks,

I'm using the Autosize-property of a label that has been created by code:

With objs.Shapes.AddLabel(msoTextOrientationHorizontal, _
lngMargin_H, lngNextControl_Top, 10, conLabel_Height).TextFrame
.TextRange.Text = "some text"
.TextRange.Font.Size = 10
.TextRange.Font.Bold = msoTrue
.AutoSize = ppAutoSizeShapeToFitText
End With

However, the .AutoSize doesn't really work - sometimes it will and
sometimes it won't (the label will be the 10pts wide that it had been
created with).
Since a hyperlink is being added thereafter I'd like the labels to not use
any space that is not occupied by the labels' text-portion.

Am I missing something here?

Thanks in advance for any suggestions!

Cheers,
Olaf
 
S

Steve Rindsberg

Olaf,

How about this, modifed a bit so it stands alone here:

With
ActivePresentation.Slides(1).Shapes.AddLabel(msoTextOrientationHorizontal, _
20, 20, 10, 24).TextFrame
.AutoSize = ppAutoSizeShapeToFitText
.TextRange.Text = "some text and more to make it longer as a test"
.TextRange.Font.Size = 10
.TextRange.Font.Bold = msoTrue
.WordWrap = msoFalse
' THIS is the main thing:
' It sets the text box (.parent) to the width of the text
.Parent.Width = .TextRange.BoundWidth
End With

--
Posted to news://msnews.microsoft.com
Steve Rindsberg, PPT MVP
PowerPoint FAQ - www.pptfaq.com
PPTools - www.pptools.com
===============================
 

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