Log in

View Full Version : Remove PP2010 Table Borders and Fill



Paul_Hossler
10-02-2011, 02:08 PM
Working on a macro to remove table fill and cell borders as part of a larger project.

I CANNOT figure out how to remove the borders

The removing the Fill seems like it must be done a cell at a time also

What I have is:


Sub Table_Format(T As Table)
Dim r As Long, c As Long


For r = 1 To T.Rows.Count
For c = 1 To T.Columns.Count
With T.Cell(r, c)

.Borders(ppBorderBottom).Visible = msoFalse
.Borders(ppBorderTop).Visible = msoFalse
.Borders(ppBorderLeft).Visible = msoFalse
.Borders(ppBorderRight).Visible = msoFalse
.Borders(ppBorderDiagonalDown).Visible = msoFalse
.Borders(ppBorderDiagonalUp).Visible = msoFalse

.Shape.Fill.ForeColor.RGB = xlColorIndexNone
End With
Next c
Next r
End Sub


Google tells me that the .Visible 'should' work

What am I doing wrong? Thanks

Paul

John Wilson
10-03-2011, 12:59 AM
Hi Paul

I think this is a bug.

The options are
1. Set the border transparency to 1 (not a good option)
2. Know someone who can delve deeply into the inner workings ;-) !

Sub Table_Format(T As Table)
Dim r As Long, c As Long
With T
'Zap borders and fill
.ApplyStyle ("{2D5ABB26-0587-4C30-8999-92F81FD0307C}")
End With
'###############################
'optionally set a new fill
For r = 1 To T.Rows.Count
For c = 1 To T.Columns.Count
With T.Cell(r, c)
.Shape.Fill.ForeColor.RGB = RGB(255, 0, 0)
End With
Next c
Next r
'################################
End Sub

You might also want to experiment with

T.Parent.Select
Application.CommandBars.ExecuteMso ("BorderNone")

John Wilson
10-03-2011, 03:04 AM
BTW

There's no way to set an RGB value to "None" (zero is Black)

Fill.Visible=False ought to work (but it's also a bug)