Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Sat, 5 Apr 2008 17:54:23 +1100,    group: microsoft.public.word.vba.beginners        back       


Table Captions automate Centre All Tables   
Back again,

Looking to centre ALL inline Tables/Figures in my document? Is that 
possible - on a deadline (every time save helps).
date: Sat, 5 Apr 2008 17:54:23 +1100   author:   PeterJ

Re: Table Captions automate Centre All Tables   
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).
>
>
>
>
>
date: Mon, 7 Apr 2008 12:26:07 +0200   author:   Stefan Blom

Re: Table Captions automate Centre All Tables   
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).
>>
>>
>>
>>
>>
>
>
>
>
date: Mon, 7 Apr 2008 20:37:40 +1000   author:   PeterJ

Re: Table Captions automate Centre All Tables   
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).
>>
>>
>>
>>
>>
>
>
>
>
date: Mon, 7 Apr 2008 20:38:31 +1000   author:   PeterJ

Re: Table Captions automate Centre All Tables   
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).
>>
>>
>>
>>
>>
>
>
>
>
date: Mon, 7 Apr 2008 21:12:05 +1000   author:   PeterJ

Re: Table Captions automate Centre All Tables   
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).
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
date: Mon, 7 Apr 2008 15:07:55 +0200   author:   Stefan Blom

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us