Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 12-27-2017, 10:04 PM
gmayor's Avatar
gmayor gmayor is offline Automatically edit formatting af tables across a document Windows 10 Automatically edit formatting af tables across a document Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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 ofgmayor has much to be proud of
Default

The macro process all story ranges which can prove awkward when selecting the tables in order to determine whether to process them, so for the following I have added a prompt for each table in the body of the document that does not match the chosen criteria. Those tables not in the body of the document are simply processed without a prompt.

Change the part of the code that processes the tables as follows

Code:
Private Sub FormatTable(oTable As Table)
Const lngBackColor As Long = wdColorGray10
    If oTable.Range.InRange(ActiveDocument.Range) = True Then
        With oTable
            If Not .Borders.OutsideLineStyle = wdLineStyleNone And _
               Not .Borders.InsideLineStyle = wdLineStyleNone And _
               Not .Shading.BackgroundPatternColor = lngBackColor Then
                .Select
                If MsgBox("Format the selected table?", vbYesNo, "Format tables") = vbYes Then
                    .Borders.OutsideLineStyle = wdLineStyleNone
                    .Borders.InsideLineStyle = wdLineStyleNone
                    .Shading.BackgroundPatternColor = lngBackColor
                End If
            End If
        End With
    Else
        With oTable
            .Borders.OutsideLineStyle = wdLineStyleNone
            .Borders.InsideLineStyle = wdLineStyleNone
            .Shading.BackgroundPatternColor = lngBackColor
        End With
    End If
lbl_Exit:
    Exit Sub
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
 

Tags
table, table across, table border



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tables in Word Document - Formatting Networkrail Word Tables 0 08-22-2017 05:49 AM
Automatically edit formatting af tables across a document Edit one document, have it automatically update other connected documents. bradyb90 Word 1 05-10-2015 10:53 AM
Forms fields: edit content easily in tables kirby gilman Word 8 12-04-2014 08:43 AM
Formatting all tables knightmetal Word 2 09-10-2012 10:53 PM
Automatically edit formatting af tables across a document How to create an Excel add in that will automatically build tables from data selvamariappan Excel Programming 1 12-12-2011 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:45 PM.


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