Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-18-2022, 09:58 AM
Abbas Abbas is offline generate contents from titles only Windows 10 generate contents from titles only Office 2016
Novice
generate contents from titles only
 
Join Date: Jan 2022
Posts: 9
Abbas is on a distinguished road
Default generate contents from titles only

Is there a way to generate table-of-contents from titles only using Vba Macro?
Reply With Quote
  #2  
Old 07-18-2022, 03:59 PM
macropod's Avatar
macropod macropod is offline generate contents from titles only Windows 10 generate contents from titles only Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Why bother, when a TOC field can do the same thing? Indeed, were I to be doing it with VBA, I'd simply have the code insert the TOC field. Any other 'Table of Contents' would not update to reflect subsequent document edits.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-19-2022, 02:18 AM
Abbas Abbas is offline generate contents from titles only Windows 10 generate contents from titles only Office 2016
Novice
generate contents from titles only
 
Join Date: Jan 2022
Posts: 9
Abbas is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Why bother, when a TOC field can do the same thing? Indeed, were I to be doing it with VBA, I'd simply have the code insert the TOC field. Any other 'Table of Contents' would not update to reflect subsequent document edits.
Hi brother,
TOC field would generate 'Table of Contents' from the 'headings' only, not from 'titles'
Thanks
Reply With Quote
  #4  
Old 07-19-2022, 07:28 AM
macropod's Avatar
macropod macropod is offline generate contents from titles only Windows 10 generate contents from titles only Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Firstly, is there a reason you're not using Heading Styles for the titles?

Secondly, regarding:
Quote:
Originally Posted by Abbas View Post
TOC field would generate 'Table of Contents' from the 'headings' only, not from 'titles'
Word's TOC field can build a Table of Contents from content other than that to which Heading Styles have been applied.See: TOC Tips and Tricks
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-21-2022, 02:35 PM
Charles Kenyon Charles Kenyon is offline generate contents from titles only Windows 11 generate contents from titles only Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
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

  1. Why Use Word's Built-In Heading Styles? by Shauna Kelly
  2. You can have a TOC field display any paragraph style(s) you want and limit it to certain styles, or even to certain parts of the document. Learn how to use this field! TOC Tips and Tricks by Suzanne Barnhill, MVP
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining titles in a TOC BeverlyS Word 2 07-22-2021 03:01 AM
Macro for deleting cell contents based on another cells contents SJCrawley Excel Programming 1 06-04-2021 01:05 AM
generate contents from titles only Manipulating Headings so Image contents is correctly referenced in Table of Contents dynamictiger Word 2 05-29-2019 05:41 AM
generate contents from titles only convert first row to titles guycruls Excel 1 01-13-2015 04:27 PM
generate contents from titles only Customize styles for Chapters and paragraph titles on pages and table of contents tzanarella Word 1 07-11-2014 12:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:53 PM.


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