I have headings named in two rows (e.g.)
Indiana Jones
Raiders of the Lost Ark
Indiana Jones
and the Temple of Doom
but when I insert table of contents I get:
Indiana Jones........................................2
Raiders of the Lost Ark............................2
Indiana Jones .......................................15
and the Temple of Doom..........................15
and I want (automatic) index table like:
Indiana Jones Raiders of the Lost Ark.......2
Indiana Jones and the Temple of Doom.....15
How can I do that?
example.zip
"Relax. What is mind? No matter. What is matter? Never mind!"
Hi,
If i take your example:Indiana Jones........................................2, with the following code:
you'll haveCode:Sub Macro() Dim i For i = 1 To End Selection.MoveRight Unit:=wdWord, Count:=3, Extend:=wdExtend Selection.TypeText Text:=" " Selection.Delete Unit:=wdCharacter, Count:=1 Selection.MoveDown Unit:=wdLine, Count:=1 Next i End Sub
Indiana Jones Raiders of the Lost Ark.......2
Indiana Jones and the Temple of Doom.....15
This code works with Word 2007 and you have to put the cursor after Indiana Jones before the macro.
Bye Indy
Last edited by shg; 07-15-2009 at 05:06 PM.
zbor,
there's no need for macro code to achieve what you want. If you have a two-line title, make sure to break the line with Shift+Enter instead of just Enter. This will insert a soft line break, which in a table of contents will be ignored, so the title ends up in one line in the TOC.
teylyn
Microsoft MVP - Excel
At Excelforum, you can say "Thank you!" by clicking theicon below the post.
Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks