vba text into textbox doesn't fit with it width and height

Iban Arriola

I am creating a text box using vba in powerpoint. For that I am using the following code:

Set survey = cSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, 40, 400, 20)
    survey.TextFrame.TextRange.text = Me.QuestionBox.text


        survey.TextFrame.TextRange.font.SIZE = sh.GroupItems(1).TextFrame.TextRange.font.SIZE
        survey.TextFrame.TextRange.font.name = sh.GroupItems(1).TextFrame.TextRange.font.name
        survey.width = sh.GroupItems(1).width
        survey.height = sh.GroupItems(1).height
        survey.top = sh.GroupItems(1).top
        survey.left = sh.GroupItems(1).left

As you can notice I am using the size of another shape to make it the same size as it. This is how the shape that I am using (above) and I created (below) looks:

enter image description here

I want it to appear in 2 lines instead of one. You can see that the width and height is correct but instead of going to the second line when it reach to the border of the shape it continues. If you just modify manually the shape below and give a bit more or less width it automatically put the second word in the second line but I cannot make it happen when I do it with vba. Is there something I can use to make it happen automatically?

David Zemens

When you add new shape to the slide, your shape default settings may be preventing wordwrap.

Please try:

survey.TextFrame.WordWrap = msoTrue

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Text doesn't fit in UIButton titleLabel height for a specific font

From Dev

text area width and height doesn't change in table cell

From Dev

Javascript to return content/string which doesn't fit in given width and height of UIWebView

From Dev

Div with percentage height doesn't fit in

From Dev

ScrollView doesn't fit width of parent

From Dev

Resizing a textbox to fit text

From Dev

Text in UItextview doesn't fit iPhone screen

From Dev

Keeping a div at full height when it doesn't fit in viewport

From Dev

Ionic popover: Popover height doesn't fit to content

From Dev

Android Lollipop view height doesn't fit screen

From Dev

Show image with its maximum width only if it doesn't fit the div

From Dev

Site with a width of 1044px doesn't fit on an iPad

From Dev

Text Box Height & Width

From Java

width and height doesn't seem to work on :before pseudo-element

From Dev

Imagick compositeImage doesn't apply original width and height but smaller

From Dev

RelativeLayout width and height fill_parent doesn't work

From Dev

why doesn't height: 100% and width: 100% work?

From Dev

Why doesn't font-size equal width and height in CSS?

From Dev

getBoundingClientRect() doesn't return height and width of SVG rect

From Dev

width and height doesn't seem to work on :before pseudo-element

From Dev

why doesn't height: 100% and width: 100% work?

From Dev

Why a button with an image doesn't respect width and height settings

From Dev

Imagick compositeImage doesn't apply original width and height but smaller

From Dev

Webpage that doesn't overflow and has a 100% Height/Width

From Dev

Fit text perfectly inside a div (height and width) without affecting the size of the div

From Dev

How can I auto shrink text to fit div width and height using javascript?

From Dev

Fixed Width Columns in Textbox VBA

From Dev

Resizing the height of UILabel to fit text

From Dev

Make button width fit to the text

Related Related

  1. 1

    Text doesn't fit in UIButton titleLabel height for a specific font

  2. 2

    text area width and height doesn't change in table cell

  3. 3

    Javascript to return content/string which doesn't fit in given width and height of UIWebView

  4. 4

    Div with percentage height doesn't fit in

  5. 5

    ScrollView doesn't fit width of parent

  6. 6

    Resizing a textbox to fit text

  7. 7

    Text in UItextview doesn't fit iPhone screen

  8. 8

    Keeping a div at full height when it doesn't fit in viewport

  9. 9

    Ionic popover: Popover height doesn't fit to content

  10. 10

    Android Lollipop view height doesn't fit screen

  11. 11

    Show image with its maximum width only if it doesn't fit the div

  12. 12

    Site with a width of 1044px doesn't fit on an iPad

  13. 13

    Text Box Height & Width

  14. 14

    width and height doesn't seem to work on :before pseudo-element

  15. 15

    Imagick compositeImage doesn't apply original width and height but smaller

  16. 16

    RelativeLayout width and height fill_parent doesn't work

  17. 17

    why doesn't height: 100% and width: 100% work?

  18. 18

    Why doesn't font-size equal width and height in CSS?

  19. 19

    getBoundingClientRect() doesn't return height and width of SVG rect

  20. 20

    width and height doesn't seem to work on :before pseudo-element

  21. 21

    why doesn't height: 100% and width: 100% work?

  22. 22

    Why a button with an image doesn't respect width and height settings

  23. 23

    Imagick compositeImage doesn't apply original width and height but smaller

  24. 24

    Webpage that doesn't overflow and has a 100% Height/Width

  25. 25

    Fit text perfectly inside a div (height and width) without affecting the size of the div

  26. 26

    How can I auto shrink text to fit div width and height using javascript?

  27. 27

    Fixed Width Columns in Textbox VBA

  28. 28

    Resizing the height of UILabel to fit text

  29. 29

    Make button width fit to the text

HotTag

Archive