![]() |
#1
|
||||
|
||||
![]()
Hello Pros,
I got this 110 pages document, where almost all pages has a sections break with the headers having a different name. What is annoying, is that it's put Cell inside padding space. I was able to create a macro to remove all tables padding. But lot's of tables still had space in there. Not even consistant from one page to another. I'm so fedup to fix them one page at the time. What you need to know, every page that has a table in the header, its between 2 rows to 4 rows. I've created a macro to fix the cell padding, but I've created a problem, that it kept staying at that section page. I've tried with F8, step by step, and yup, it stayed stuck there. Code:
Dim lngIndex As Long Dim oSec As Section Dim oHead As HeaderFooter Dim i As Integer For Each oSec In ActiveDocument.Sections For lngIndex = 1 To 3 For Each oHead In oSec.Headers If oHead.Exists Then For i = oHead.Range.Tables.Count To 1 Step -1 With oHead.Range.Tables(i) '***Removes cells padding too Dim oCell As Cell Dim oTable As Table Set oTable = Selection.Tables(1) For Each oCell In oTable.Range.Cells With oCell .TopPadding = (0) .BottomPadding = (0) .LeftPadding = (0) .RightPadding = (0) End With Next oCell End With Next i End If Next oHead On Error GoTo 0 Next Next lbl_Exit: Exit Sub By the way, I'll share which one works, it's to remove all table padding from every section. So if this could be done also for the Cells paddings. I've created to test the tables in the headings, to place 1 space after each row. It works ![]() Code:
Dim lngIndex As Long Dim oSec As Section Dim oHead As HeaderFooter Dim i As Integer For Each oSec In ActiveDocument.Sections For lngIndex = 1 To 3 For Each oHead In oSec.Headers If oHead.Exists Then For i = oHead.Range.Tables.Count To 1 Step -1 'oHead.Range.Tables(i).Delete oHead.Range.Tables(i).Rows.HeightRule = wdRowHeightAuto oHead.Range.Tables(i).Rows.Height = InchesToPoints(0) oHead.Range.Tables(i).Range.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle oHead.Range.Tables(i).Range.ParagraphFormat.SpaceBefore = 0 oHead.Range.Tables(i).Range.ParagraphFormat.SpaceAfter = 1 'With Selection.Tables(1) With oHead.Range.Tables(i) .TopPadding = InchesToPoints(0) .BottomPadding = InchesToPoints(0) .LeftPadding = InchesToPoints(0) .RightPadding = InchesToPoints(0) .Spacing = 0 .AllowPageBreaks = True .AllowAutoFit = False End With Next i End If Next oHead 'Next oSec On Error GoTo 0 Next Next lbl_Exit: Exit Sub ![]() Cendrinne |
Tags |
cells padding removal, help me; |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Wild Bee | Word VBA | 3 | 02-10-2021 12:44 AM |
![]() |
baymoon | Word | 2 | 05-15-2017 09:01 PM |
![]() |
thesun | Word | 6 | 05-29-2015 11:55 AM |
![]() |
ghphoto | Word | 2 | 02-22-2015 05:49 PM |
![]() |
DBinSJ | Word | 4 | 05-01-2012 02:33 AM |