Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2023, 03:19 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help, Remove all tables borders As of here, don't work Windows 10 Help, Remove all tables borders As of here, don't work Office 2019
Competent Performer
Help, Remove all tables borders As of here, don't work
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default Help, Remove all tables borders As of here, don't work

I've tried to remove all the tables borders, as of this point with a range, and odd, It doesn't work.


I wish to keep the tables borders before my selection. I thought a selection of Tables range would only affect those table.

Anyway, here is my script, but it touches ALL TABLES

Here is the script I've created:
HTML Code:
    Dim xTbl As Table, oRng As Range
 
      Application.ScreenUpdating = False
    
        For Each xTbl In ActiveDocument.Range.Tables
           Set oRng = ActiveDocument.Range(Selection.Range.Start, ActiveDocument.Range.End)
     
    With xTbl.Borders

      xTbl.Borders.InsideLineStyle = wdLineStyleNone
      xTbl.Borders.OutsideLineStyle = wdLineStyleNone
    End With

    Next

  Application.ScreenUpdating = True
What am I doing wrong?
or it's not doable.

Please any insights would be greatly appreciated

C
__________________
_______________________________
Cendrinne

Last edited by Cendrinne; 03-30-2023 at 12:42 AM. Reason: added precision and corr typos.
Reply With Quote
  #2  
Old 03-29-2023, 09:01 PM
gmayor's Avatar
gmayor gmayor is offline Help, Remove all tables borders As of here, don't work Windows 10 Help, Remove all tables borders As of here, don't work Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Try the following
Code:
Sub Macro1()
Dim oTable As Table
Dim oBorder As Border
    For Each oTable In ActiveDocument.Tables
        For Each oBorder In oTable.Borders
            oBorder.LineStyle = wdLineStyleNone
        Next oBorder
    Next oTable
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 03-29-2023, 10:34 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help, Remove all tables borders As of here, don't work Windows 10 Help, Remove all tables borders As of here, don't work Office 2019
Competent Performer
Help, Remove all tables borders As of here, don't work
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default Hey Graham, Thanks for the help

I guess I didn't specify in this box, I wish to not touch the tables done before.

I could have lots of tables fixed, and a bunch not fixed. So I wish to remove the borders as of this point forward, that is what I've attemted to write in the title. And leave the tables done before my cursor, intact.

Think it's doable? I've tried a number of ways, it doesn't work.

I ended up removing them manually, well one table at the time.

Sorry if I wasn't clear, but thank you for trying

C.
__________________
_______________________________
Cendrinne
Reply With Quote
  #4  
Old 03-30-2023, 02:14 AM
gmayor's Avatar
gmayor gmayor is offline Help, Remove all tables borders As of here, don't work Windows 10 Help, Remove all tables borders As of here, don't work Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If you want to process tables from the cursor position, then set a range to the area you wish to process e.g.


Code:
Sub Macro2()
Dim oRng As Range
Dim oTable As Table
Dim oBorder As Border
    Set oRng = ActiveDocument.Range
    oRng.Start = Selection.Start
    For Each oTable In oRng.Tables
        For Each oBorder In oTable.Borders
            oBorder.LineStyle = wdLineStyleNone
        Next oBorder
    Next oTable
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 03-30-2023, 11:58 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help, Remove all tables borders As of here, don't work Windows 10 Help, Remove all tables borders As of here, don't work Office 2019
Competent Performer
Help, Remove all tables borders As of here, don't work
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Talking OMG GRAHAM!!!!!! Yes you did it, WOW THANKS

OMG thank you soooooo much.
That is brilliant. I've tried many ways, and I almost thought it was hopeless, but you pull a rabbit out of the hat!!!! Like Magic

Thank you from the bottom of my heart, you saved me tons of frustrating work, doing it one table at the time, if I didn't want to lose what I've done previously that was fixed.

I thought I could save the borders, that is why I didn't removed them from the start, but you have a wonderful plan B if I'm in the middle of my long long document.

Thank you a whole bunch.

C.
__________________
_______________________________
Cendrinne
Reply With Quote
Reply

Tags
help please, table borders

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Tables in All Headers in Every Section - Remove cell's padding Cendrinne Word VBA 6 03-06-2022 04:26 AM
Help, Remove all tables borders As of here, don't work Count numer of areas between boarders tdody Excel Programming 4 08-13-2015 01:02 PM
Help, Remove all tables borders As of here, don't work Does anyone know how to remove breaks between tables? chrisd2000 Word Tables 18 07-02-2014 02:48 PM
How to remove background when copy and paste, no fill doesn't work. mingo Word 1 07-29-2010 02:25 PM
How to remove background in word. 'No Fill' does not work! mingo Word 0 07-27-2010 01:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft