Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2023, 07:31 PM
SYR1245 SYR1245 is offline how to have multiple headings on the same line in ms word toc Windows 10 how to have multiple headings on the same line in ms word toc Office 2021
Novice
how to have multiple headings on the same line in ms word toc
 
Join Date: May 2023
Posts: 2
SYR1245 is on a distinguished road
Default how to have multiple headings on the same line in ms word toc


Hi.
I am writing a book, in microsoft word, with chapters and subsections. I would like to format my table of contents to look like below, where Heading1 is the chapter title and heading3 is the subsection title. How could I set this up?

Heading1 Page x

Heading3 p#, Heading3 p#, Heading3 p#, Heading3 p#, Heading3 p#.....

Heading1 Page x

Heading3 p#, Heading3 p#, Heading3 p#, Heading3 p#, Heading3 p#.....
thank you
Reply With Quote
  #2  
Old 05-07-2023, 09:39 PM
Guessed's Avatar
Guessed Guessed is offline how to have multiple headings on the same line in ms word toc Windows 10 how to have multiple headings on the same line in ms word toc Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,161
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

As far as I know there is no way with field codes to create a TOC that follows that pattern.

It would be possible to create a macro that refreshes a TOC and then replaces the paragraph marks on TOC3 with a "comma space". It would need to leave the TOC field locked to prevent accidental refreshing which would return the merged paragraphs back to their "normal" state

Is there a reason your description avoids Heading 2?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 05-08-2023, 09:35 AM
Charles Kenyon Charles Kenyon is offline how to have multiple headings on the same line in ms word toc Windows 11 how to have multiple headings on the same line in ms word toc Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,469
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I agree with Andrew. You could modify your TOC field so that the page numbers for level 3 follow the text rather than being right justified with a dot leader. You would still have to lock and modify the field to get your result.

You could have one main TOC and subsidiary TOCs for each chapter and have detail in the Chapter TOC.

See TOC Tips and Tricks by Suzanne Barnhill, MVP.
Reply With Quote
  #4  
Old 05-08-2023, 01:36 PM
Charles Kenyon Charles Kenyon is offline how to have multiple headings on the same line in ms word toc Windows 11 how to have multiple headings on the same line in ms word toc Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,469
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Cross-posted at:MS Answers - ms word TOC subheadings on the same line


For cross-posting etiquette, please read: A Message to Forum Cross-Posters A message to forum cross posters - Excelguru
Reply With Quote
  #5  
Old 05-08-2023, 04:13 PM
Guessed's Avatar
Guessed Guessed is offline how to have multiple headings on the same line in ms word toc Windows 10 how to have multiple headings on the same line in ms word toc Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,161
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

If you used this macro to build or update your TOC it shows the basic principles. I set it for Heading 2 rather than Heading 3.
Code:
Sub TOCshrinker()
  Dim aTOC As TableOfContents, aRng As Range, aPara As Paragraph, iPara As Integer, aFld As Field
  If ActiveDocument.TablesOfContents.Count = 0 Then
    Set aRng = ActiveDocument.Range(0, 0)
    Set aTOC = ActiveDocument.TablesOfContents.Add(Range:=aRng, UseOutlineLevels:=True, UpperHeadingLevel:=1, LowerHeadingLevel:=3, RightAlignPageNumbers:=False, UseHyperlinks:=True)
  Else
    Set aTOC = ActiveDocument.TablesOfContents(1)
  End If
  With aTOC
    .Range.Fields(1).Locked = False
    .Update
    For iPara = aTOC.Range.Paragraphs.Count To 1 Step -1
      Set aPara = aTOC.Range.Paragraphs(iPara)
      If aPara.Style = "TOC 2" And aPara.Next.Style = "TOC 2" Then
        aPara.Range.Characters.Last = ", "
      End If
    Next iPara
    .Range.Fields(1).Locked = True
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #6  
Old 05-10-2023, 07:21 PM
SYR1245 SYR1245 is offline how to have multiple headings on the same line in ms word toc Windows 10 how to have multiple headings on the same line in ms word toc Office 2021
Novice
how to have multiple headings on the same line in ms word toc
 
Join Date: May 2023
Posts: 2
SYR1245 is on a distinguished road
Default

thanks
I happened to be using heading 2 for something else.
Could you give me some basics on using marcos? I havent used them before
Reply With Quote
  #7  
Old 05-10-2023, 08:56 PM
Charles Kenyon Charles Kenyon is offline how to have multiple headings on the same line in ms word toc Windows 11 how to have multiple headings on the same line in ms word toc Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,469
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Reply With Quote
  #8  
Old 01-10-2025, 12:14 PM
popsncandies popsncandies is offline how to have multiple headings on the same line in ms word toc Windows 11 how to have multiple headings on the same line in ms word toc Office 2021
Novice
 
Join Date: Jan 2025
Posts: 1
popsncandies is on a distinguished road
Default I think I know how to do it...

I was trying to figure it out myself, hence how I landed here.

If you type out your headings in separate lines:

Heading 2
Heading 2
Heading 2

Then go to your Table of Contents to refresh it so that they are all on it, you want them to be on the same page, and the page they will actually land on. I suggest doing this when you're done adding content or close to.

Go back to your headings, pick the line you want them on, hit tab then highlight and drag the next one up to that main line, hit tab, do the same with the next etc.:

Heading 2 (your needed tab space) Heading 2 (your needed tab space) Heading 2

If you need to refresh you table of contents, select numbers only. Which is why suggest you already have most of your work/ all your headings in place before doing so.

I realize I'm late to the discussion but I hope this makes sense and is helpful!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine Headings in Table of Contents on one line jlkirk Word 8 03-14-2023 02:21 PM
how to have multiple headings on the same line in ms word toc Trouble with extra blank space on line when using "Chapter" Headings in Microsoft Word chudlerk Word 4 11-10-2021 11:27 AM
how to have multiple headings on the same line in ms word toc How do I get text to line up with their headings? Kimbre Word 5 11-22-2017 07:43 PM
Transfer data from list with multiple headings from word to excel psohms Word 1 06-11-2015 04:39 PM
how to have multiple headings on the same line in ms word toc Multiple styles on same line in Microsoft Word jhopppppp Word 2 12-05-2008 10:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft