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 change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
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,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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