Consulting

Results 1 to 3 of 3

Thread: Remove PP2010 Table Borders and Fill

  1. #1
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,727
    Location

    Remove PP2010 Table Borders and Fill

    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:

    [VBA]
    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
    [/VBA]

    Google tells me that the .Visible 'should' work

    What am I doing wrong? Thanks

    Paul

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    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 ;-) !

    [vba]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[/vba]

    You might also want to experiment with

    [VBA] T.Parent.Select
    Application.CommandBars.ExecuteMso ("BorderNone")[/VBA]
    Last edited by John Wilson; 10-03-2011 at 01:21 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    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)
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •