I have a bunch of PowerPoint slides I need to reformat, and I'd like to figure out a way to select all lines on the page - including those with arrowheads.
I found this post that included some VBA for selecting all lines on a slide, but it doesn't capture lines with arrowheads. How could I update this code to grab all lines, including those with arrowheads?
Sub getLines()
Dim oshp As Shape
Dim osld As Slide
On Error Resume Next
Set osld = ActiveWindow.Selection.SlideRange(1)
If Not osld Is Nothing Then
For Each oshp In osld.Shapes
If oshp.Type = msoLine Then oshp.Select Replace:=msoFalse
Next oshp
End If
End Sub 1 Answer
Update the selection to include msAutoShape as well as msoLine as follows:
Sub getLines()
Dim oshp As Shape
Dim osld As Slide
On Error Resume Next
Set osld = ActiveWindow.Selection.SlideRange(1)
If Not osld Is Nothing Then
For Each oshp In osld.Shapes
If (oshp.Type = msoLine Or oshp.Type = msoAutoShape) Then oshp.Select Replace:=msoFalse
Next oshp
End If
End SubI was able to figure out the VBA shape type using this macro here which steps through every shape on a slide, and displays the object type in a window. Super helpful!