Resize Every Table Of my Powerpoint Document

Monres

New Member
Joined
Jun 18, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Guys I really need some help. I have tons of tables in a powerpoint document. Some are 2 in x 2 in and some are 3.5 x 3.5 in. I need to resize only the 3.5x3.5 tables to a size of 2.8x2.8
I know this can be done with some easy vba code, but I don't possess the knowledge for it. I know it has to go something like this:
Sub format()

Dim s As Slide
Dim oSh As Shape
Dim oTbl As Table

For Each s In ActivePresentation.Slides
For Each oSh In s.Shapes
If oSh.HasTable Then
Set oTbl = oSh.Table
SOMETHING NEEDS TO GO HERE to check the size of the table and resize only if it is 3.5x3.5
Next
Next
End If
Next ' Shape
Next s
End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try...

VBA Code:
For Each s In ActivePresentation.Slides
    For Each oSh In s.Shapes
        If oSh.HasTable Then
            If oSh.Width = 252 And oSh.Height = 252 Then '252 points = 3.5 in
                With oSh
                    .LockAspectRatio = msoFalse
                    .Width = 201.6  '201.6 points = 2.8 in
                    .Height = 201.6 '201.6 points = 2.8 in
                End With
            End If
        End If
    Next oSh
Next s

Hope this helps!
 
Upvote 0
Solution
Beautiful! Thank you so much for your help! You are amazing!
 
Upvote 0
You're very welcome, and thanks for the feedback.

Cheers!
 
Upvote 0

Forum statistics

Threads
1,215,650
Messages
6,126,019
Members
449,280
Latest member
Miahr

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