Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2012, 12:39 PM
viuf viuf is offline autofit text to shape (msoShapeRectangle) Windows XP autofit text to shape (msoShapeRectangle) Office 2007
Novice
autofit text to shape (msoShapeRectangle)
 
Join Date: Feb 2012
Posts: 10
viuf is on a distinguished road
Default autofit text to shape (msoShapeRectangle)

Hi...



I'm trying to autofit som text in a shape (a Rectangle), but I can only find autofit in ordinary textboxes. Can anybody help?

Thanks in advance

Code:
Set oshp = ActivePresentation.Slides(1).Shapes _
.addShape(msoShapeRectangle, left, top, width, height) ' left, top, width, height
    With oshp
        .Name = "Kategori" & countTwo
    End With
    With oshp.TextFrame.TextRange
        .Text = categories(countTwo)
    End With
    
    With oshp.Fill
        .ForeColor.RGB = RGB(200, 200, 200)
        .Visible = True
    End With
Reply With Quote
  #2  
Old 02-20-2012, 01:43 PM
JohnWilson JohnWilson is offline autofit text to shape (msoShapeRectangle) Windows 7 64bit autofit text to shape (msoShapeRectangle) Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,820
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

You may need to use TextFrame2 instead of TextFrame to access this new method

TextFrame2.AutoSize=msoAutoSizeTextToFitShape
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 02-20-2012, 02:11 PM
viuf viuf is offline autofit text to shape (msoShapeRectangle) Windows XP autofit text to shape (msoShapeRectangle) Office 2007
Novice
autofit text to shape (msoShapeRectangle)
 
Join Date: Feb 2012
Posts: 10
viuf is on a distinguished road
Default

Thanks John (Again ) works like a charm!

And again an additional question:

Is there a way to set a minimum font-size and if it is reached (because of to much text in the box) then only display a certain number of characters?

Ex.
there is 100 characters in a textbox (100 x 100) and because of autofit the fontsize is reduced to 4 pt.
Instead of that I would like the fontsize to be set to 7 pt. and only 70 characters displayed followed by "..."
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
autofit text to shape (msoShapeRectangle) Adding text to auto shape and rotating Hot Mumma Word 1 06-14-2011 05:15 PM
autofit text to shape (msoShapeRectangle) Autofit Image to a Preset Cell GarethHourihane Drawing and Graphics 6 06-02-2011 05:05 AM
Custom shape in charts? gilezajner PowerPoint 0 12-15-2010 02:21 AM
autofit text to shape (msoShapeRectangle) Shape Objects Space Cowboy PowerPoint 4 10-04-2010 07:14 PM
Table Autofit Behavior Default Henri Blits Word Tables 0 07-18-2006 03:49 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 12:54 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft