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)

[TABLE="width: 500"]
<tbody>[TR]
[TD]Contents[/TD]
[TD]Page #[/TD]
[TD]Unique ID[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Title from Page[/TD]
[TD]1[/TD]
[TD]1-1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Quality Checks[/TD]
[TD]1[/TD]
[TD]1-2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sounding board[/TD]
[TD]2[/TD]
[TD]2-1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Checklist[/TD]
[TD]3[/TD]
[TD]3-1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Page by Page Details[/TD]
[TD]4[/TD]
[TD]4-1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Reference Data[/TD]
[TD]4[/TD]
[TD]4-2[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Really need a VBA code for this if possible.

Thanks in advance,
Matt
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,926
Messages
6,181,793
Members
453,067
Latest member
cernytomas

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
Back
Top