How do you get rid of an empty line at the end of a slide?

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

How do you get rid of an empty line at the end of a slide?

Post by New Daddy »

How do you automatically get rid of an empty line at the end of a slide?

User avatar
HansV
Administrator
Posts: 78231
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How do you get rid of an empty line at the end of a slid

Post by HansV »

What happens if you click in that line and press Backspace?
Or if you click at the end of the line above it and press Delete?
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: How do you get rid of an empty line at the end of a slid

Post by New Daddy »

HansV wrote:What happens if you click in that line and press Backspace?
Or if you click at the end of the line above it and press Delete?
Is there an "automatic" way of removing all end-of-slide empty lines? That was actually the gist of my OP, although I couldn't put in the word "automatically" in the title due to space limit.

User avatar
HansV
Administrator
Posts: 78231
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How do you get rid of an empty line at the end of a slid

Post by HansV »

You could run the following macro:

Code: Select all

Sub RemoveEmpties()
    Dim sld As Slide
    Dim shp As Shape
    Dim tfm As TextFrame
    Dim trg As TextRange
    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            If shp.HasTextFrame Then
                Set tfm = shp.TextFrame
                Set trg = tfm.TextRange
                Do While Right(trg.Text, 1) = vbCr
                    trg.Text = Left(trg.Text, Len(trg.Text) - 1)
                Loop
            End If
        Next shp
    Next sld
End Sub
Unfortunately, PowerPoint doesn't have a global macro container such as Normal.dotm for Word or Personal.xlsb for Excel. The only way to make a macro available in all presentations is by creating and loading a PowerPoint add-in (.ppam) that adds a button to the ribbon (or to a custom toolbar). See for example How to Add a Ribbon Entry That Runs a Macro in 2007 and/or Create an ADD-IN with TOOLBARS that run macros.
Best wishes,
Hans

New Daddy
4StarLounger
Posts: 437
Joined: 05 Nov 2012, 20:02

Re: How do you get rid of an empty line at the end of a slid

Post by New Daddy »

HansV wrote: Unfortunately, PowerPoint doesn't have a global macro container such as Normal.dotm for Word or Personal.xlsb for Excel. The only way to make a macro available in all presentations is by creating and loading a PowerPoint add-in (.ppam) that adds a button to the ribbon (or to a custom toolbar). See for example How to Add a Ribbon Entry That Runs a Macro in 2007 and/or Create an ADD-IN with TOOLBARS that run macros.
Thanks! This will be a bigger project than I hoped.