Word Table of Contents to Excel Spreadsheet

Datatellsall2

New Member
Joined
Jul 17, 2018
Messages
23
Hello -

I'm trying to convert a table of contents in word to go into the following table in excel via VBA. I would like the table of contents details (excluding the page #) to be one column, and the next column would include the page number for reference. If possible, I would like a unique ID to be assigned based on the page number. For instance if I have a data on page 1 and it's the first reference, I would like it to read 1-1; the first number would be the page number and the second number would be the unique ID. Here is an example :

Word table of contents:
Title from Page - page 1
Quality Checks - page 1
Sounding board - page 2
Checklist - page 3
Page by Page Details - page 4
Reference Data - page 4

Excel Document: (example output)

ContentsPage #Unique ID
Title from Page11-1
Quality Checks11-2
Sounding board22-1
Checklist33-1
Page by Page Details44-1
Reference Data44-2

<tbody>
</tbody>

Really need a VBA code for this if possible.

Thanks in advance,
Matt
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,559
Messages
5,832,500
Members
430,136
Latest member
Asir Jefferson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top