Results 1 to 7 of 7

Thread: [RESOLVED] Powerpoint 2000, Insert Shape, FontSize Problem

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2009
    Posts
    7

    Resolved [RESOLVED] Powerpoint 2000, Insert Shape, FontSize Problem

    Hello everyone:

    I am trying to programmatically generate a Powerpoint Slideshow out of Content stored in some XML format.

    Along the way, i sometimes need to add more than one TextArea to a slide, to display several kinds of text info
    (Standard Text: Times New Roman 24; Code Samples: Courier New 18)

    Adding another TextArea works just fine
    Code:
     MyPresentation.Slides.Item(i).Shapes.AddTextBox(....)
    but now comes the catch:

    i'm trying to apply Font Settings to this new Shape (FontName, FontSize, FontColor), and it does accept the FontName just fine, so does the FontColor.

    But it does _not_ accept the FontSize.

    Im doin it like this:
    Code:
    ' MyPresentaton as Powerpoint.Presentation
    ' ppNewShape as Powerpoint.Shape
    MyPresentation.Slides.Item(iCurSlide).Shapes.AddTextBox(Office.MsoTextOrientation.msoTextOrientationHorizontal, iLeft, iTop, iWidth, iHeight)
    ppNewShape = CType(MyPresentation.Slides.Item(iCurSlides).Shapes(MyPresentation.Slides.Items(iCurSlide).Shapes.Count - 1), PowerPoint.Shape)
    
    ppNewShape.TextFrame.TextRange.Font.Name = sNewFontName ' Works fine
    ppNewShape.TextFrame.TextRange.Font.Size = CSng(iNewFontSize) ' Doesn't Work
    ppNewShape.TextFrame.TextRange.Font.Color.RGB = RGB(iRed, iGreen, iBlue) ' Works fine

    But the FontSize of the NewShape stays the same. I've watched it with the debugger, it just doesnt accept the value. FontName works (it goes into the properties "Name" and "NameAscii" automatically, interesting), so does FontColor, but not the FontSize, and this is drivin me crazy.

    Due to the environment i have to work in i'm limited to Office2000, but i do have Visual Studio 2008....

    Could this be a Powerpoint Bug, could the Property Getter for "Font.Size" be wrong (like in the guessing game a few days ago in the VB Wire News)?

    Does anyone know how i could get this to work? Any help is appreciated,
    Solutions, Workarounds, i'll take anything... *desparate*

    Thanx in advance...

    Mike aka StoneTheIceman

    =============================

    Supplement:

    I've got the code i use by recording a VBA-Macro inside Powerpoint and cut'n'pasting
    the code into my Studio Project.... inside Powerpoint VBA it works just fine (including FontSize!!!),
    but the very same code ran by Visual Studio against Powerpoint - nada.
    I'm helpless........
    Last edited by StoneTheIceman; Sep 11th, 2009 at 09:46 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width