Link to home
Start Free TrialLog in
Avatar of dshrenik
dshrenikFlag for United States of America

asked on

Table border (PpwerPoint 2010)

Please tell me how once can increase the thickness of just the top border of a table.
Also, I want to change the left and right margins of a table cell.

If possible, please give me a step-by-step procedure. Thanks!
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Set the cursor in the table, then on the draew borders pane, select the pen color, thickness etc then stoill on the same pane select the draw table button.\
Now click the mouse on the top or left/right borsers where you want the line.

Chris
Alternatively select VBA, (alt + F11) followed by insert | Module


Now paste the following code therein

It set the top border to thickness 10, and incidentally changes the color but you can drop that if required

It then selects cell 4 in row 3 and sets the left and right borders to something else.  Modify the reference to the shape as appropriate, (the test slide had it as shape 3.

Chris
Sub topBorder()
Dim sh As Shape
    With Application.ActivePresentation.Slides(1).Shapes(3).Table
        With .Rows(1).Cells.Borders(ppBorderTop)
            .ForeColor.RGB = vbRed
            .Weight = 10
        End With
        With .Cell(3, 4).Borders(ppBorderLeft)
            .ForeColor.RGB = vbRed
            .Weight = 5
        End With
        With .Cell(3, 4).Borders(ppBorderRight)
            .ForeColor.RGB = vbGreen
            .Weight = 5
        End With
    End With
End Sub

Open in new window

Avatar of dshrenik

ASKER

Thanks! Can you tell me how one can change (increase)  the left and right margins of a table cell.
To simplify shape selection for VBA you can for example, select the slide using the cursor.  Now on the Home tab, editing pane select "select" ... "Selection pane" from the drop down.

Find your table and change the name for example to Fred

Modify the selection in the earlier code from:

    With Application.ActivePresentation.Slides(1).Shapes(3).Table
to

    With Application.ActivePresentation.Slides(1).Shapes("fred").Table

Chris
Via the application or VBA?
I'm not particular about the method.
Whichever is easier.
INteractive note the draw borders pane requires the table to be selected then the design tab activated

Chris
Easiest is probably VBA since we can read the current setting.  To do this replace:


            .Weight = 5
with

            .Weight = .Weight + 1

Chris
I am sorry. I meant, how do I increase the left and right margins for the contents inside a table cell.
Basically, I want to increase the left, right, bottom and top padding inside a cell.
Select the table, layout cell margins
How do I get layout?
Apologies ... in the cell margins, select custom to display the cutrrent internal margins and to adjust them.

Selecting a range of cells adjusts for all of the selected cells

Chris
I'm sorry, can you give me a step by step procedure. Where do I find cell margins?
ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!
Sorry I missed the difference between the margin and border requests, but glad it helped in the end.

Chris
Looking at it but it's not so straight forward and will need VBA, (I believe) - if indeed it can be done at all!

Chris
Sure. I dont mind using VBA.