Consulting

Results 1 to 2 of 2

Thread: Powerpoint macro to use shape text label to populate name shown in selection pane

  1. #1
    VBAX Newbie
    Joined
    Feb 2019
    Posts
    1
    Location

    Powerpoint macro to use shape text label to populate name shown in selection pane

    I have a slide with over 230 rectangles (containing text labels, e.g. Marketing).


    In the selection pane the rectangles all have names like 'Rectangle3'


    To aid selection, I'm trying to come up with a macro to go through the rectangle text labels, and replace the corresponding selection pane name, e.g. Marketing >> Rectangle3 becomes Marketing >> Marketing


    I'm pretty new to VBA in powerpoint and struggling to work this one out


    I think I need to copy the 'label' attribute to the 'name' but not sure how to go about it

    Any tips appreciated
    thanks
    Nick

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,795
    Location
    Not completely clear what you mean by TEXT LABEL" assuming you mean you added text to the shapes try this. Note this will modify ALL slides. For just the current slide (or selected slides)

    Replace
    For Each osld In ActivePresentation.Slides
    With
    For Each osld In ActiveWindow.Selection.SlideRange

    Sub fixSelPane()
    Dim osld As Slide
    Dim oshp As Shape
    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    If oshp.HasTextFrame Then
    If oshp.TextFrame.HasText Then
    oshp.Name = oshp.TextFrame.TextRange
    End If
    End If
    Next
    Next
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

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
  •