The code you've supplied applies to all tables in the document - nothing about it indicates that you've made any changes to accommodate it to the code I posted, so it only applies to the nested table. For example:
Note: I've tidied up your code and added more structure and formatting to it.Sub Demo() Application.ScreenUpdating = False Dim Tbl As Table, Cll As Cell For Each Tbl In ActiveDocument.Tables For Each Cll In Tbl.Range.Cells If Cll.Tables.Count > 0 Then With Cll.Tables(1) 'Nested Table as a whole .Range.Cells.VerticalAlignment = wdAlignVerticalTop .PreferredWidthType = wdPreferredWidthPercent .PreferredWidth = 100 .RightPadding = 5 'measurement in points .LeftPadding = 5 'measurement in points .TopPadding = 0 'measurement in points .BottomPadding = 0 'measurement in points .Shading.Texture = wdTextureSolid .Shading.ForegroundPatternColor = wdColorWhite With .Range.Font .Name = "TimesNewRoman" .Size = 10 End With With .Rows .SpaceBetweenColumns = CentimetersToPoints(0.2) .AllowBreakAcrossPages = False .Alignment = wdAlignRowCenter .HeightRule = wdRowHeightAuto End With With .Borders .InsideLineStyle = wdLineStyleSingle .InsideLineWidth = wdLineWidth050pt .InsideColor = wdColorGray25 .OutsideLineStyle = wdLineStyleNone End With With .Rows(1) 'First Row variation .HeadingFormat = True With .Range .Font.Bold = True .ParagraphFormat.Alignment = wdAlignParagraphCenter End With With .Shading .Texture = wdTexture10Percent .ForegroundPatternColorIndex = wdBlack .BackgroundPatternColorIndex = wdWhite End With With .Borders .Item(wdBorderTop).LineStyle = wdLineStyleSingle .Item(wdBorderBottom).LineStyle = wdLineStyleSingle .Item(wdBorderTop).LineWidth = wdLineWidth150pt .Item(wdBorderBottom).LineWidth = wdLineWidth150pt .Item(wdBorderTop).Color = wdColorBlack .Item(wdBorderBottom).Color = wdColorBlack End With End With With .Rows(.Rows.Count) 'Last Row variation With .Borders .Item(wdBorderBottom).LineStyle = wdLineStyleSingle .Item(wdBorderBottom).LineWidth = wdLineWidth150pt .Item(wdBorderBottom).Color = wdColorBlack End With End With End With End If Next Next Application.ScreenUpdating = True End Sub
PS: When posting code, please format your code and use the code tags, indicated by the # button on the posting menu. Without them, your (formatted) code loses much of whatever structure it had.




Reply With Quote
