Christopher Greaves |
|||
Christopher Greaves |
|||
If you are interested in applications please visit www.VBASolutions.ca .
If you are interested in end-user macros please visit www.TorontoMacros.com .
We can create a document or template with named list templates.
We can check that we have done so by using the macro “TESTReportListTemplatesInDocument” from List Templates In The Document .
Our report in the Immediate Window will look something like this (quantities may vary):
False 1False 1
False 1
False 1
False 1
False 1
False 1
False 1
False 1
False 1
False 1 CG_FigureCaptionWide
False 1 CG_FigureCaption
False 1 CG_SubStep
False 1 CG_NumberBegin
False 1 CG_Bullet
False 1 CG_TitleNumberPart
False 1 CG_SubBullet
False 1 CG_StepContinue
False 1 CG_FigureCaptionIndent
False 1 CG_TitleNumberChapter
False 1 CG_Checkbox
False 1 CG_TableTitle
False 1 CG_TitleNumberAppendix
False 1 CG_NumberContinue
False 1 CG_BulletIndent
False 1 CG_StepBegin
False 1 CG_SubStepBullet
The methods shown as available to us for the Listtemplate object do not include Delete or Remove.
VBA Help says of the Convert Method: Converts a multiple-level list to a single-level list, or vice versa.
We could be our usual optimistic selves and try the Delete method.
You never know …
lstT.Remove fares no better.
We never give up.
Shauna Kelly says:
No, you can't delete a list template <***sigh***>. Word 2000 used to fall
over when a limit was reached (I can't now remember what the limit was).
Word 2002 and Word 2003 will, eventually, delete unused ListTemplates if a
document nears the limit. At least that's what's supposed to happen; the
only way to really test it would be to get a whole lot of user-created
documents and examine them. But I haven't run into problems with this in
2002 or 2003.
You can sometimes copy great chunks of text (generally, excluding section
marks) from one document to another and leave behind unused list templates.
But it needs to be Friday 29 February, with a full moon, and you need
several black cats available to make it reliable.
For what it's worth, I try to manage this issue as follows:
1. Create a template by doing File > New and and in the FileNew dialog box,
click the Template radio button. That is, don't start with a copy of an
existing template, or use File > Save As to turn a document into a template.
Creating a template by doing File > New ensures that you create a clean
template. For what it's worth, a clean template is *not* based on
normal.dot. It's generated by the Word executable with all Word's defaults.
2. Do everything you can (eg set up styles and ListTemplates) in code, so
that, in development, you can create a new template and replicate it at
will.
3. Teach users to create a new file by doing File > New. Obviously creating
a new document by opening an old one and doing File > Save As can lead to
cumulative problems.
Hope this helps.
Shauna Kelly. Microsoft MVP. http://www.shaunakelly.com/word
What about a method whereby we break all links between Paragraphs, Styles and List Templates?
I am also conscious of a solution along the lines of “save the
document as HTML, reopen, save as Word doc” ( http://groups.google.com/group/microsoft.public.word.vba.general/browse_thread/thread/6f5052d032f77fbf/4a50a1c12105bce9?lnk=gst&q=delete+list+templates#4a50a1c12105bce9 )
Then at http://groups.google.com/group/microsoft.public.word.numbering/browse_thread/thread/1d95062fcea9f78/b9df31c131b78a4f?lnk=st&q=named+list+templates.#b9df31c131b78a4f there’s this:
c) "deleting all the unnecessary list templates" - List
Templates *can't* be deleted; except in the sense that if
you select all and deselect the final paragraph mark, and
paste into a new document, you'll leave behind any unused
List Templates.
Paste To New Document