Powerpoint 2007 textframe.autosize

Hi,

I am have a VBA script to generate a powerpoint slideshow from data in a SQL Server. It works perfectly on office 2000 and 2003 but not with office 2007. After some debugging it appears to me that the offending line is when i set the textframe.autosize property.

After looking through the msdn library I noticed that there is no Powerpoint reference manual under 2007 office suites.

Can anyone point in in the right direction on this one

Thanks



Answer this question

Powerpoint 2007 textframe.autosize

  • Vaish

    Hi,

    You do not say what the actual problem or error is. Or what code you are using.

    I did notice from my very limited testing that the width of the textbox does not appear to be automatic.


  • barkingdog

    I had the same problem when I took my application from PowerPoint 2003 to 2007. All of my TextBoxes were .41" high no matter what i set the height property to in the AddTextBox method. Here is the code I finally got to work.

    PowerPoint.Shape theText = slide.Shapes.AddTextbox(TextOrientation,
    x, y,Width, Height);

    theText.TextFrame.TextRange.Text = " ";
    theText.TextFrame.AutoSize = PowerPoint.PpAutoSize.ppAutoSizeNone;
    theText.TextFrame.VerticalAnchor = TextAnchor;
    theText.Height = Height;


    After I set the AutoSize property my height was messed up, so I just reset the height and it all worked correctly. Seems to be a bug in the AutoSize property.

  • ehsan sadeghi

    Even I am recieving the same error while it is working fine with 2003 Object model.

    When I do

    Private moPowerPointApp As Microsoft.Office.Interop.PowerPoint.Application

    moPowerPointApp.ActiveWindow.Selection.TextRange.Characters.Count

    Above line gives an error called "The specified value is out of range." when the selection is made in a table object present in one of the ppt slide.

    And above is working fine when I use 2003 object model.

    Is there some substitute for the above change

    Its urgent. any help will subtract my problem.

    Thanks!!!


  • AshishGupta

    Yep...

    I'm having the same problem.

    I have now ommitted the autosize line for Powerpoint 2007.


  • KeithFranklin

    Hi Andy,

    I'm using the following code

    Set PowerpointApplication = CreateObject("PowerPoint.Application")
    Set ThisPresentation = PowerpointApplication.Presentations.Add
    Set ThisSlide = ThisPresentation.Slides.Add(1, 12)

    ThisSlide.Shapes.AddShape 1, 0, 0, 720, 50
    ThisSlide.Shapes(1).Name = "SlideHeader"
    ThisSlide.Shapes("SlideHeader").Fill.Forecolor.RGB = RGB(128,128,128)

    Set ThisTextShape = ThisSlide.Shapes.AddTextBox(1, 0, 30, 350, 50)
    ThisTextShape.TextFrame.TextRange.Text = "Owner: John Doe"
    ThisTextShape.TextFrame.TextRange.Font.Name="Arial"
    ThisTextShape.TextFrame.TextRange.Font.Size=10
    ThisTextShape.TextFrame.Autosize=2
    ThisTextShape.TextFrame.TextRange.Font.Color.RGB = RGB(255, 255, 255)
    ThisTextShape.TextFrame.TextRange.ParagraphFormat.Alignment = 1

    if i take out the textframe.autosize it works with powerpoint 2007 but looks terrible. it all works in office 2003, xp, 2000

    how come microsoft do not have a development reference for powerpoint 2007 on msdn

    Thanks again


  • svenderuyter

    I am experiencing a similar issue with our software application which uses OLE/COM to export our document content into PPT file format.

    Our export routines are implemented using C++ and when we invoke the TextFrame.AutoSize( ppAutoSizeShapeToFitText ) call with PowerPoint 2007, we receive a "The specified value is out of range" error.

    The PPT constants defined as valid arguments for AutoSize are:

    typedef enum {
    ppAutoSizeMixed = -2,
    ppAutoSizeNone = 0,
    ppAutoSizeShapeToFitText = 1
    } PpAutoSize;

    and have worked fine with all prior versions of Office, but not with Office 2007.

    I have used the OLE/COM Object Viewer to look at the interface specification in the MSPPT.OLB file which is part of the Office 12/2007 distribution and the ppAutoSize constants are defined exactly as above, so I am starting to think that this is a Microsoft bug in PowerPoint 2007.

    boland0980, were you able to resolve this issue

    I did notice that you were setting AutoSize to 2, did you try using any other values, e.g. -2, 0 or 1

    Has anyone else experienced a similar problem with TextFrame.AutoSize

  • Powerpoint 2007 textframe.autosize