Results 1 to 12 of 12
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tables - Removing Borders

    Can anyone help please.

    I want to run a module that willremove the borders from all tables in a document before saving it. The number of tables will vary from document to document

    many thanks

    Regards

    John

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tables - Removing Borders

    Are you talking about actual borders, such as you apply using the format menu, or table gridlines, which are made visible from the Tables menu?
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    Hi Charlotte,

    Its the actual cell borders, by default my Word is set so that on inserting a table the borders are set to "Grid" option. Is there a way to set the Table format so that the borders are set to None as soon as the document opens?

    Regards

    John

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tables - Removing Borders

    You can turn off the visible gridlines by selecting HideGridlines from the Table menu. Borders are set from the Format menu and have to be turned off by either setting the border property to none or making the color the same as your background. Does that help?
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    Hi Charlotte,

    Thanks for this. To be honest not really, as I need to use some code to work it waysthrough a document selecting each table in turn and removing the borders or alternatively I need to set the borders option to none as soon as the new document opens.

    Regards

    John

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    My UnderTheHood template has it. You can't read the code, but you can execute the macro. From the Under Toolbar choose the TABLES menu, then the ALL menu, then CMD_NONE.

  7. #7
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Tables - Removing Borders

    John,

    One thing that's been confusing me is your mention of turning the table borders off when the document opens.

    Is it the case that you want the tables to permanently remain with borders, but for some reason you want these turned off each time the document opens (and turned back on again later)?

    Or do you simply want a way to permanently remove the borders from specific existing tables, as well as have the option to create new tables minus borders?

    (One more question<g>: you mention setting the border option to none as soon as a new document opens - do you need this to be a setting that applies to only specific documents (i.e. based on a specific template), or do you need this to be a setting that applies to all documents?)

    Gary

    Gary

  8. #8
    JustCallMeAl
    Guest

    Re: Tables - Removing Borders

    Try this, works in Word97SR2:

    <pre>Public Sub TableNoBorders()

    Dim aTable As Table
    Dim aBorder As Border

    For Each aTable In activedocument.Tables
    For Each aBorder In aTable.Borders
    aBorder.Visible = False
    Next aBorder
    Next aTable

    End Sub
    </pre>


  9. #9
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    Hi Chris,

    Thank you for the template is it excellent. Is there any chance you can forward me the code behind the CMD_None module?

    Many thanks

    Kind Regards

    John

  10. #10
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    Hi Big Al,

    Your a superstar! Thank you very much it works a treat!

    Kind Regards

    John

  11. #11
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    Hi Gary,

    Thank you for your help, Big AL has solved the problem for me.

    Kind Regards

    John

  12. #12
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables - Removing Borders

    Try this:
    <pre>Option Explicit

    Public Sub cmd_None()
    ' Procedure: cmd_None
    ' Description: Remove formatting from the current table.
    ' By: Chris Greaves Inc.
    ' Inputs: None.
    ' Returns: None.
    ' Assumes: None.
    ' Side Effects: None.
    ' Tested: By a call from the user.
    If Selection.Information(wdWithInTable) Then
    Call CellsNone(Selection.Tables(1).Range)
    Else
    Call errMustBeInTable
    End If
    End Sub


    Public Function CellsNone(rngCells As Range)
    ' Procedure: CellsNone
    ' Description: Remove all line formatting from the range of cells.
    ' Copyright: Chris Greaves Inc.
    ' Inputs: None
    ' Returns: None
    ' Assumes: Nothing
    ' Side Effects: The current paragraph formatting may change.
    ' Tested: By a call from the user.
    If rngCells.Information(wdWithInTable) Then
    With rngCells.Cells
    .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    .Borders(wdBorderRight).LineStyle = wdLineStyleNone
    .Borders(wdBorderTop).LineStyle = wdLineStyleNone
    .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
    .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
    .Borders.Shadow = False
    End With
    Else
    Call errMustBeInTable
    End If
    End Function

    Public Function errMustBeInTable()
    MsgBox "Please place the text cursor within a table and try running this command again"
    End Function
    </pre>


Posting Permissions

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