Re: programmatically insert lots of text into a power point presentation.
From: Steve Rindsberg (abuse_at_localhost.com)
Date: 06/26/04
- Next message: Steve Rindsberg: "Re: displaying text"
- Previous message: Steve Rindsberg: "Re: not another VIDEO question"
- In reply to: Scott Jacobsen: "Re: programmatically insert lots of text into a power point presentation."
- Next in thread: Bill Dilworth: "Re: programmatically insert lots of text into a power point presentation."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Jun 2004 20:28:19 EDT
> I suppose I can figure out how many physical lines of text will fit on
> one slide for a given font just by opening up PP and typing in lines.
> That's easy enough.
>
> But one input phrase doesn't == one line of text, because it might
> word wrap. I could count the number of characters that fit on one
> physical line. Then I could assume a phrase will wrap at the last
> whitespace character <= the max number of chars per line.
>
> But I'm hoping there is some way for pp to do this for me, or at least
> just tell me how many lines are in a text box.
>
This should do you. Knowing the font height and line spacing, you should be in good shape:
Function LineCount(oSh As Shape) As Long
' return zero if no text, -1 if error
LineCount = 0
On Error GoTo ErrorHandler
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
LineCount = .TextFrame.TextRange.Lines.Count
End If
End If
End With
NormalExit:
Exit Function
ErrorHandler:
LineCount = -1
Resume NormalExit
End Function
Sub TestLineCount()
' Use currently selected shape
Debug.Print LineCount(ActiveWindow.Selection.ShapeRange(1))
End Sub
> > Are you using this in a presentation? or are you using this to publish
> It is a requirement of an existing application. I'm just the grunt
> coder who has to do it :)
>
> > Post back if you still need the macro to break the over-sized textboxes onto
> > multiple slides based on the number of lines in the textbox.
> That macro would be great.
>
> Thanks
>
-- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ Featured Presenter, PowerPoint Live 2004 October 10-13, San Diego, CA www.PowerPointLive.com ================================================
- Next message: Steve Rindsberg: "Re: displaying text"
- Previous message: Steve Rindsberg: "Re: not another VIDEO question"
- In reply to: Scott Jacobsen: "Re: programmatically insert lots of text into a power point presentation."
- Next in thread: Bill Dilworth: "Re: programmatically insert lots of text into a power point presentation."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|