Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
When I create a TOC it only fills a little over half a page and then goes to
the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
I am not sure from your description, but the problem could be that one or
more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Hi Lene,
I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
The Line and Page Breaks tab is one of the tabs in the dialog box named
Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Lene,
Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Could you post the macro? Maybe it will help finding the problem.
(I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Lene,
Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
I have looked at your code and tested it and I cannot see anything that
should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Lene,
I tried your macro but get the following error at .Fields.Add Compile error: Invalid or unqualified reference "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
I forgot to say that I tried it on other documents and it did the same thing
on them. The TOC fills only half a page. "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#11
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
When inserting the new code lines, you must keep the lines:
With ActiveDocument (insert the code here) End With Maybe you removed the With/End With lines? -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: I forgot to say that I tried it on other documents and it did the same thing on them. The TOC fills only half a page. "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#12
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Lene,
The problem is in the \h . If I include it the macro the TOC fills the whole page but the formatting is wrong. If I take out \h the TOC fills half the page but the TOC format is correct. "Lene Fredborg" wrote: When inserting the new code lines, you must keep the lines: With ActiveDocument (insert the code here) End With Maybe you removed the With/End With lines? -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: I forgot to say that I tried it on other documents and it did the same thing on them. The TOC fills only half a page. "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#13
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
Lene,
I figured out the problem. In the following part of the macro I deleted the following line and it worked fine. The TOC filled the whole page. HidePageNumbersInWeb:=True, UseOutlineLevels:=True With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With "Lene Fredborg" wrote: When inserting the new code lines, you must keep the lines: With ActiveDocument (insert the code here) End With Maybe you removed the With/End With lines? -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: I forgot to say that I tried it on other documents and it did the same thing on them. The TOC fills only half a page. "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#14
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
I am definitely not sure what happens. Have you checked the style definition
of the Hyperlink style (applied as a character style on top of the TOC styles when the \h switch is included)? By default, Hyperlink will be defined to add blue color and underline - however, it may be modified to whatever a character style can be. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, The problem is in the \h . If I include it the macro the TOC fills the whole page but the formatting is wrong. If I take out \h the TOC fills half the page but the TOC format is correct. "Lene Fredborg" wrote: When inserting the new code lines, you must keep the lines: With ActiveDocument (insert the code here) End With Maybe you removed the With/End With lines? -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: I forgot to say that I tried it on other documents and it did the same thing on them. The TOC fills only half a page. "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
#15
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
TOC fills only 1/2 page
I am glad the problem is solved.
-- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, I figured out the problem. In the following part of the macro I deleted the following line and it worked fine. The TOC filled the whole page. HidePageNumbersInWeb:=True, UseOutlineLevels:=True With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With "Lene Fredborg" wrote: When inserting the new code lines, you must keep the lines: With ActiveDocument (insert the code here) End With Maybe you removed the With/End With lines? -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: I forgot to say that I tried it on other documents and it did the same thing on them. The TOC fills only half a page. "Lene Fredborg" wrote: I have looked at your code and tested it and I cannot see anything that should cause the problems you experience. Does the problem occur in a single document only? Does it make any difference if you replace the code between €śWith ActiveDocument€ť and €śEnd With€ť by the following code? Dim oField As Field Set oField = .Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty) With oField .Code.Text = "TOC \o " & Chr(34) & "1-2" & Chr(34) & " \h \z " .Update End With Set oField = Nothing The code above adds a TOC field with the field code: TOC \o €ś1-2€ť \h \z (delete \h from the code above if you do not want the TOC entries to work as hyperlinks) whereas the field inserted by your code has other switches: TOC \o €ś1-2€ť \f \z \u The Word help tells about the \u switch: Builds a table of contents by using the applied paragraph outline level. Do you have TC fields in the document? (the \f switch) Actually, I cannot tell whether it would make any difference replacing the code but it may be worth a try. If it does not help, you could e-mail the problem document to me (you can extract an e-mail address from my profile). I will then have a look in order to see whether I can find out what happens. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Here it is. Sub CreateTOC() With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument.Styles("TOC 2") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 2").ParagraphFormat .LeftIndent = InchesToPoints(0.5) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(-0.5) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 2").NoSpaceBetweenParagraphsOfSameStyle = True With ActiveDocument.Styles("TOC 1") .AutomaticallyUpdate = True .BaseStyle = "Normal" .NextParagraphStyle = "Normal" End With With ActiveDocument.Styles("TOC 1").ParagraphFormat .LeftIndent = InchesToPoints(0) .RightIndent = InchesToPoints(0.5) .SpaceBefore = 12 .SpaceBeforeAuto = False .SpaceAfter = 0 .SpaceAfterAuto = False .LineSpacingRule = wdLineSpaceSingle .Alignment = wdAlignParagraphLeft .WidowControl = False .KeepWithNext = False .KeepTogether = False .PageBreakBefore = False .NoLineNumber = False .Hyphenation = False .FirstLineIndent = InchesToPoints(0) .OutlineLevel = wdOutlineLevelBodyText .CharacterUnitLeftIndent = 0 .CharacterUnitRightIndent = 0 .CharacterUnitFirstLineIndent = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 End With ActiveDocument.Styles("TOC 1").NoSpaceBetweenParagraphsOfSameStyle = False With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _ LowerHeadingLevel:=2, UseFields:=True, TableID:="C", _ IncludePageNumbers:=True, AddedStyles:="", UseHyperlinks:=False, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=True .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With End Sub "Lene Fredborg" wrote: Could you post the macro? Maybe it will help finding the problem. (I may not look at your macro until tomorrow - it is well after midnight in Denmark now). -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Lene, Nothing is checked in the Line and Page Breaks. Also, if I create a TOC using the toolbar it works (uses the full page). If I record it as a macro and run it, it only uses half of the page. "Lene Fredborg" wrote: The Line and Page Breaks tab is one of the tabs in the dialog box named Paragraph. -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: Hi Lene, I am using TOC 1 and TOC 2. I do not see any Lines and Page breaks tab. Any other ideas? "Lene Fredborg" wrote: I am not sure from your description, but the problem could be that one or more of the TOC styles have been defined with €śPage break before€ť turned on (set in the Paragraph dialog box, Lines and Page Breaks tab). If this is the case, modify the TOC style(s) in question. Normally, TOC 1 is related to Heading 1, TOC 2 to Heading 2, etc. For help on modifying a style, see: http://www.shaunakelly.com/word/styl...ifyAStyle.html -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "LEU" wrote: When I create a TOC it only fills a little over half a page and then goes to the next page and does the same thing. How do I get it to fill the whole page? Im using Word 2003. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I use a checkbox that fills in automatically if needed? | Tables | |||
How 2 create an empty box that fills with a tick when clicked on? | Page Layout | |||
Graduated fills in Word 2007 | Tables | |||
Background image that fills the page - How!!! | Page Layout | |||
Border fills more than one table cell | Tables |