PowerPoint VBA Loop through each slide set up dimension for each linked excel range

lynnsong986

Board Regular
Joined
May 24, 2014
Messages
146
Hello,

I have a bunch of slides with the same layout - a title box and a linked or embedded range from excel below the title box. I need to loop through all slides and re-set the dimensions for the linked excel range on each slide. I need to write something like:

Dim Sld As Slide
For Each Sld In ActivePresentation.Slides
For Each Shape In Sld.Shapes
If Shape.Type = 7 Or 10 Then
With Shape
.ShapeRange.Left = 1
.ShapeRange.Top = 1
.ShapeRange.Height = 1
.ShapeRange.Width = 1

End With
End If
Next
Next
End Sub

I've never written any codes in powerpoint before, I just used my excel vba knowledge to write the above - the codes gave error message when it comes to the purple part. can someone please help me fix it?

thanks
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try...

Code:
If Shape.Type = 7 Or Shape.Type = 10 Then
    With Shape
        .Left = 1
        .Top = 1
        .Height = 1
        .Width = 1
    End With
End If

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top