Is there an easy way of doing this rather than going thru each table?
Also, is there a way to reset all Heading styles (Heading1 - Heading4) to 'indent from left' to -1.
Thanks.
Autofit *all* tables to 'Autofit to Window'
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
-
- PlutoniumLounger
- Posts: 15798
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Autofit *all* tables to 'Autofit to Window'
Try the little macro "AutoFitContentAllTables" in the attached document.Robie wrote:Is there an easy way of doing this rather than going thru each table?
You do not have the required permissions to view the files attached to this post.
By definition, educating the client is the consultant’s first objective
-
- Administrator
- Posts: 78894
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Autofit *all* tables to 'Autofit to Window'
This macro will loop through all tables in the active document:
Code: Select all
Sub AdjustAllTables()
Dim tbl As Table
For Each tbl In ActiveDocument.Tables
tbl.AutoFitBehavior wdAutoFitWindow
Next tbl
End Sub
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78894
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Autofit *all* tables to 'Autofit to Window'
And this one will set the left indent for Heading 1...4:
Code: Select all
Sub AdjustStyles()
ActiveDocument.Styles(wdStyleHeading1).ParagraphFormat.LeftIndent = _
Application.InchesToPoints(-1)
ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat.LeftIndent = _
Application.InchesToPoints(-1)
ActiveDocument.Styles(wdStyleHeading3).ParagraphFormat.LeftIndent = _
Application.InchesToPoints(-1)
ActiveDocument.Styles(wdStyleHeading4).ParagraphFormat.LeftIndent = _
Application.InchesToPoints(-1)
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Re: Autofit *all* tables to 'Autofit to Window'
Wow. Thanks Chris and Hans. I thought it would reams and reams of VBA code. A big THANKS.
Sorry, one more question in relation to the paragraphs with heading styles. I have found that when I import these document into the current template all the headings are *lowercase*. It seems in their template the heading styles were set with 'ALL CAPS'. Now, is there a way to set up my Heading styles with *Initial letter as CAP*? For example '3. defects fixed in this release' would become '3. Defects fixed in this release'. I can see all options as part of the font settings but not this .
Sorry, one more question in relation to the paragraphs with heading styles. I have found that when I import these document into the current template all the headings are *lowercase*. It seems in their template the heading styles were set with 'ALL CAPS'. Now, is there a way to set up my Heading styles with *Initial letter as CAP*? For example '3. defects fixed in this release' would become '3. Defects fixed in this release'. I can see all options as part of the font settings but not this .
-
- Administrator
- Posts: 78894
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Autofit *all* tables to 'Autofit to Window'
"First letter in upper case" is not a font, paragraph or style property. You could run this macro to "repair" the headings:
Code: Select all
Sub FixCaps()
Dim par As Paragraph
For Each par In ActiveDocument.Paragraphs
Select Case par.Style
Case ActiveDocument.Styles(wdStyleHeading1), _
ActiveDocument.Styles(wdStyleHeading2), _
ActiveDocument.Styles(wdStyleHeading3), _
ActiveDocument.Styles(wdStyleHeading4)
par.Range.Case = wdTitleSentence
End Select
Next par
End Sub
Best wishes,
Hans
Hans