Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Long Documents / November 2003

Tip: Looking for answers? Try searching our database.

TOC Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sam - 04 Nov 2003 10:21 GMT
I am using Word 97.

I need to create a macro that creates a contents page.

Basically I will type the word 'Contents', right tab to
the right margin and type 'page'. Press return and then
to 'insert' 'table of contents'.  I click on the options
box and make sure that every single style is deselected
and that the only style ticked is my 'section headings
style'. I then 'okay' this I end up with exactly what I
want.

The problem occurs when I play back the macro.  Everything
is fine except it adds in loads of extra headings in my
TOC which didn't appear while recording. I can go into the
TOC options again and remove the ticks but it defeats the
point of trying to speed up the process with macros.

Does anyone know what I'm doing wrong?

Thank you
Shauna Kelly - 04 Nov 2003 12:04 GMT
Hi Sam

If your aim is to make it easy to add a ToC to a document, then I
wouldn't use a macro; I'd use an AutoText. To do that, create your
contents page as you want it to be. Select the text and do Insert >
AutoText. Give your AutoText a name (eg "ContentsPage"). If you want it
to be available to all documents, choose to save it in normal.dot. If
you want it available only to documents in a particular template, choose
that template.

Now, whenever you want to insert your contents page, type ContentsPage
and press F3.

However, if you need to use a macro for some other purpose, bear in mind
that the macro recorder isn't perfect. Reply here and post your code
into the message, and we'll see what we can do to clean it up for you.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word
Melbourne, Australia

> I am using Word 97.
>
[quoted text clipped - 17 lines]
>
> Thank you
Sam - 04 Nov 2003 13:12 GMT
Thanks very much for your help Shauna

Yes my aim is to make it easy to add a contents page, but
not just for me - it is for anyone who happens to use this
template.

What you told me to do works great for me and it seems to
work on any document I'm in (so long as it has the same
styles).  

I would also like to make it available to everyone when in
that template but don't seem to have the option to do this
it just allows me to name it and that's it.

Where do I choose to save it to the template?

Sam

>-----Original Message-----
>Hi Sam
[quoted text clipped - 43 lines]
>
>.
Suzanne S. Barnhill - 04 Nov 2003 13:55 GMT
When you create the AutoText entry, choose your specific document template
in the "Look in" box at the bottom of the AutoText dialog. Then your entry
will be saved in that template instead of Normal.dot. Be sure to change
"Look in" back to "All active templates" before closing the dialog or you
won't have access to the AT entries in Normal.dot.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Signature

Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


> Thanks very much for your help Shauna
>
[quoted text clipped - 74 lines]
> >
> >.
Clive Huggan - 08 Nov 2003 01:31 GMT
Sam,

Alluding to your comment "I would also like to make it available to everyone
when in that template", if I take it that people might not know the AutoText
feature for the toc is available in the template, you can make the feature
more accessible to your colleagues by creating a custom toolbar that's
available in that template or documents based on it. (I often create a
special toolbar for a doc/template that has styles etc used in the
particular document/template.)

-- Clive Huggan

> When you create the AutoText entry, choose your specific document template
> in the "Look in" box at the bottom of the AutoText dialog. Then your entry
[quoted text clipped - 89 lines]
>>>
>>> .
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.