power point VBA , tables

ziad alsayed

Well-known Member
Joined
Jul 17, 2010
Messages
665
dear all
i have a power presentation with seven slides, each slide has a title and table, i need to select each table in each slide and put its measurments (width and Height), of course the tables dont have the same measurments
hope you can assist me with a code that select each table in each slide and i will add the measurments.
thanks in advance.
 
a very big thanks for you :beerchug:

You are welcome. This new version will center tables:

Code:
Option Explicit
Option Base 1
' this code goes at a PowerPoint module


Sub SizeTables()
Dim TabWid, TabHei, shp As Shape, i%, pres As Presentation


TabWid = Array(400, 300, 200)   ' desired table widths
TabHei = Array(350, 250, 150)   ' desired table heights
Set pres = ActivePresentation
If UBound(TabWid) <> UBound(TabHei) Then Exit Sub


For i = 1 To UBound(TabWid)     ' this example works with 3 slides


    For Each shp In pres.Slides(i).Shapes
    
        If shp.HasTable Then Exit For   ' finds first table
        
    Next
    With shp
        .Width = TabWid(i)
        .Height = TabHei(i)
        .Top = (pres.PageSetup.SlideHeight - .Height) / 2
        .Left = (pres.PageSetup.SlideWidth - .Width) / 2
    End With
Next
End Sub
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,225,635
Messages
6,186,128
Members
453,340
Latest member
Stu61

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