Back again, Looking to centre ALL inline Tables/Figures in my document? Is that possible - on a deadline (every time save helps).
This very simple macro should work: Sub AlignmentTest() Dim i As InlineShape Dim t As Table For Each i In ActiveDocument.InlineShapes i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter Next i For Each t In ActiveDocument.Tables t.Rows.Alignment = wdAlignRowCenter Next t End Sub But note that the macro does *not* adjust the positions of any table or figure captions accompanying the tables and figures. -- Stefan Blom Microsoft Word MVP "PeterJ" wrote in message news:%23CqYjnulIHA.2268@TK2MSFTNGP02.phx.gbl... > Back again, > > Looking to centre ALL inline Tables/Figures in my document? Is that > possible - on a deadline (every time save helps). > > > > >
Stefan, thank you, shall try it now! You guys are very helpful in my hour of need! "Stefan Blom" wrote in message news:eZy2KnJmIHA.5956@TK2MSFTNGP03.phx.gbl... > This very simple macro should work: > > Sub AlignmentTest() > Dim i As InlineShape > Dim t As Table > For Each i In ActiveDocument.InlineShapes > i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter > > Next i > > For Each t In ActiveDocument.Tables > t.Rows.Alignment = wdAlignRowCenter > > Next t > End Sub > > But note that the macro does *not* adjust the positions of any table or > figure captions accompanying the tables and figures. > > -- > Stefan Blom > Microsoft Word MVP > > > "PeterJ" wrote in message news:%23CqYjnulIHA.2268@TK2MSFTNGP02.phx.gbl... >> Back again, >> >> Looking to centre ALL inline Tables/Figures in my document? Is that >> possible - on a deadline (every time save helps). >> >> >> >> >> > > > >
That's fine the BUT I've got a style turned on (formatting heaven)! "Stefan Blom" wrote in message news:eZy2KnJmIHA.5956@TK2MSFTNGP03.phx.gbl... > This very simple macro should work: > > Sub AlignmentTest() > Dim i As InlineShape > Dim t As Table > For Each i In ActiveDocument.InlineShapes > i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter > > Next i > > For Each t In ActiveDocument.Tables > t.Rows.Alignment = wdAlignRowCenter > > Next t > End Sub > > But note that the macro does *not* adjust the positions of any table or > figure captions accompanying the tables and figures. > > -- > Stefan Blom > Microsoft Word MVP > > > "PeterJ" wrote in message news:%23CqYjnulIHA.2268@TK2MSFTNGP02.phx.gbl... >> Back again, >> >> Looking to centre ALL inline Tables/Figures in my document? Is that >> possible - on a deadline (every time save helps). >> >> >> >> >> > > > >
Stefan, how do I incorporate With Selection.Tables(1) .TopPadding = InchesToPoints(0) .BottomPadding = InchesToPoints(0) .LeftPadding = InchesToPoints(0) .RightPadding = InchesToPoints(0) .Spacing = 0 .AllowPageBreaks = False .AllowAutoFit = False End With in top part of macro? Sub Alignment() 'But note that the macro does *not* adjust the positions of any table or 'figure captions accompanying the tables and figures. Dim i As InlineShape Dim t As Table For Each i In ActiveDocument.InlineShapes i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter Next i For Each t In ActiveDocument.Tables t.Rows.Alignment = wdAlignRowCenter t.Rows.WrapAroundText = False t.Rows.HorizontalPosition = wdTableCenter t.Rows.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn t.Rows.DistanceLeft = InchesToPoints(0) t.Rows.DistanceRight = InchesToPoints(0) t.Rows.VerticalPosition = InchesToPoints(0) t.Rows.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph t.Rows.DistanceTop = InchesToPoints(0.6) t.Rows.DistanceBottom = InchesToPoints(0.2) t.Rows.AllowOverlap = True Next t End Sub "Stefan Blom" wrote in message news:eZy2KnJmIHA.5956@TK2MSFTNGP03.phx.gbl... > This very simple macro should work: > > Sub AlignmentTest() > Dim i As InlineShape > Dim t As Table > For Each i In ActiveDocument.InlineShapes > i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter > > Next i > > For Each t In ActiveDocument.Tables > t.Rows.Alignment = wdAlignRowCenter > > Next t > End Sub > > But note that the macro does *not* adjust the positions of any table or > figure captions accompanying the tables and figures. > > -- > Stefan Blom > Microsoft Word MVP > > > "PeterJ" wrote in message news:%23CqYjnulIHA.2268@TK2MSFTNGP02.phx.gbl... >> Back again, >> >> Looking to centre ALL inline Tables/Figures in my document? Is that >> possible - on a deadline (every time save helps). >> >> >> >> >> > > > >
You can use With t .TopPadding = InchesToPoints(0) .BottomPadding = InchesToPoints(0) .LeftPadding = InchesToPoints(0) .RightPadding = InchesToPoints(0) .Spacing = 0 .AllowPageBreaks = False .AllowAutoFit = False End With instead of With Selection.Tables(1)... End With. Of course, this assumes that the code is inside For Each t In ActiveDocument.Tables... Next t. -- Stefan Blom Microsoft Word MVP "PeterJ" wrote in message news:%23IVD7AKmIHA.5820@TK2MSFTNGP04.phx.gbl... > Stefan, how do I incorporate > > With Selection.Tables(1) > .TopPadding = InchesToPoints(0) > .BottomPadding = InchesToPoints(0) > .LeftPadding = InchesToPoints(0) > .RightPadding = InchesToPoints(0) > .Spacing = 0 > .AllowPageBreaks = False > .AllowAutoFit = False > End With > in top part of macro? > > > Sub Alignment() > > 'But note that the macro does *not* adjust the positions of any table or > 'figure captions accompanying the tables and figures. > > Dim i As InlineShape > Dim t As Table > For Each i In ActiveDocument.InlineShapes > i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter > > Next i > > For Each t In ActiveDocument.Tables > t.Rows.Alignment = wdAlignRowCenter > t.Rows.WrapAroundText = False > t.Rows.HorizontalPosition = wdTableCenter > t.Rows.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn > t.Rows.DistanceLeft = InchesToPoints(0) > t.Rows.DistanceRight = InchesToPoints(0) > t.Rows.VerticalPosition = InchesToPoints(0) > t.Rows.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph > t.Rows.DistanceTop = InchesToPoints(0.6) > t.Rows.DistanceBottom = InchesToPoints(0.2) > t.Rows.AllowOverlap = True > > Next t > End Sub > > "Stefan Blom" wrote in message > news:eZy2KnJmIHA.5956@TK2MSFTNGP03.phx.gbl... >> This very simple macro should work: >> >> Sub AlignmentTest() >> Dim i As InlineShape >> Dim t As Table >> For Each i In ActiveDocument.InlineShapes >> i.Range.Paragraphs(1).Alignment = wdAlignParagraphCenter >> >> Next i >> >> For Each t In ActiveDocument.Tables >> t.Rows.Alignment = wdAlignRowCenter >> >> Next t >> End Sub >> >> But note that the macro does *not* adjust the positions of any table or >> figure captions accompanying the tables and figures. >> >> -- >> Stefan Blom >> Microsoft Word MVP >> >> >> "PeterJ" wrote in message news:%23CqYjnulIHA.2268@TK2MSFTNGP02.phx.gbl... >>> Back again, >>> >>> Looking to centre ALL inline Tables/Figures in my document? Is that >>> possible - on a deadline (every time save helps). >>> >>> >>> >>> >>> >> >> >> >> > >