View Single Post
 
Old 07-17-2020, 09:26 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I looked a Andrews code and while I can see it will do something, I don't see how it will catch all cases. I could be wrong.


As for identifying non-uniformity in tables, try:

Code:
Option Explicit
Sub ProcessTables()
Dim oTbl As Table
Dim oNT As Table
  For Each oTbl In ActiveDocument.Tables
    MarkNonUniformity oTbl
    For Each oNT In oTbl.Tables
      MarkNonUniformity oNT
    Next oNT
  Next oTbl
lbl_Exit:
  Exit Sub
End Sub
Sub MarkNonUniformity(oTbl As Table)
'A basic Word macro coded by Greg Maxey
Dim oRow As Row, oCol As Column
Dim bVM As Boolean, bHM As Boolean, bBoth As Boolean
  bVM = False: bHM = False: bBoth = False
  With oTbl
    If Not .Uniform Then
      On Error Resume Next
      Set oRow = .Rows(1)
      If Err.Number = 5991 Then bVM = True
      Err.Clear
      Set oCol = oTbl.Columns(1)
      If Err.Number = 5992 Then bHM = True
      If bVM And bHM Then bBoth = True
      Select Case True
        Case bBoth: .Range.Cells(1).Shading.BackgroundPatternColor = wdColorGreen
        Case bVM: .Range.Cells(1).Shading.BackgroundPatternColor = wdColorRose
        Case bHM: .Range.Cells(1).Shading.BackgroundPatternColor = wdColorPaleBlue
      End Select
    End If
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote