Consulting

Results 1 to 4 of 4

Thread: Remove only outside table borders - updating code

  1. #1
    VBAX Regular
    Joined
    Dec 2018
    Posts
    24
    Location

    Smile Remove only outside table borders - updating code

    Hi Andy / John

    I've been trying to write code to remove only the 4 outside borders of any table that's selected. I found this closest code by Andy (after hours of googling and editing codes I've found online), but it's from 2006 and no longer works:
    http://www.vbaexpress.com/forum/show...Outline-border

    Any help would be much appreciated, as always, thank you.

    Dim tblTemp As Table
    
    Set tblTemp = ActivePresentation.Slides(1).Shapes(3).Table
    With tblTemp
    .Rows(1).Cells.Borders.Item(ppBorderTop).Visible = msoFalse
    .Rows(.Rows.Count).Cells.Borders.Item(ppBorderBottom).Visible = msoFalse
    .Columns(1).Cells.Borders.Item(ppBorderLeft).Visible = msoFalse
    .Columns(.Columns.Count).Cells.Borders.Item(ppBorderRight).Visible = msoFalse
    End With
    
    It's just to remove (or make white to hide) the outside borders of any table, no matter how many rows or columns it has, no existing inside borders are changed.

    Thank you

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,131
    Location
    Does this work for you
    Sub ClearBorders()
    Dim b as Variant
    For each in Array(xlEdgeTop, xlEdgeBottom, xlEdgeleft, XlEdgeRight)
       Selection.Borders(b).Linestyle = xlNone
    Next
    End Sub
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,095
    Location
    There's a long standing bug in the Object Model. I have reported it several times!

    Possible workarounds

    1. Select the cell (with code) and run
    CommandBars.ExecuteMso("BordersNone")
    You will get an error if the cell is not selected.

    2 Set the Border to .Transparency=1
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,131
    Location
    Thank you John
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Tags for this Thread

Posting Permissions

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