MS Word field

jakobt

Active Member
Joined
May 31, 2010
Messages
337
I have a word document on 50 pages. In the document is added 75 sentences which include actions for instance a sentence like: "Suggest to include Robert in Group 2."

Now I would like in the bottom of the document to update a list with all 75 sentences of action, including which header and page number they can be found under.

Is it possible to assign a variable to each sentence called action, and then write a piece of code to update a list with all these sentences.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You could create an Index. See: Create and update an index
To include the corresponding heading, You would need to insert STYLEREF fields into the XE fields, pointing to whatever Heading Style or other Style you're using for the headings. See: Field codes: StyleRef field
For example, suppose you have various heading in the Heading 1 Style and you want to index all the action items under those headings. The simplest way to tag the index entries would be to:
1. Press Ctrl-F9 twice, to create a nested pair of field braces (i.e. { { } })
2. Fill in the fields so that you get {XE "{STYLEREF "Heading 1"}:Action to be taken"}
3. Repeat Steps 1 & 2 for each action item, changing the 'Action to be taken' text as appropriate.
4. At the end of the document, Press Ctrl-F9 once and fill in the field so that you get {INDEX}
5. Press Ctrl-A, F9 to update all fields in the document. You will now have an index at the end of the document looking like:
Rich (BB code):
Some Heading
          Action item1,     1
          Action item2,     1
          Action item3,     2
          Action item4,     6
Another Heading
          Action item5,     11
          Action item6,     12
Yet Another Heading
          Action item7,     12
          Action item8,     13
and so on. Do be aware, though, that the index entries and sub-entries will appear in alphabetical order, not necessarily in page order as indicated above.

To have everything in page order, you'd need to use Heading Styles for both the headings (e.g. Heading 1) and sub-headings (e.g. Heading 2) for the action items, and a Table of Contents to collate the data.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

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