Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to delete a ListTemplate ?

6 views
Skip to first unread message

Ian Sharpe

unread,
Nov 28, 2001, 4:38:28 AM11/28/01
to
Am I missing something ?

You can Add your own template using VB, or let Word add one for you whenever
you modify a list.
So how do they get cleaned out when they are no longer used.

I have written a script to list all the document-embedded templates, and now
I want to clean out
all the unused occurrences. But therein lies the problem, I can't seem to
find a Delete function.

Can anybody help ?

:o)


Steve Hudson

unread,
Nov 28, 2001, 9:43:17 PM11/28/01
to
Teee hee hee hee. Oh yes indeedy, the world is full of suckers like us
trying to actually USE listtemplates. Heavens forbid, they're just
window-dressing aren't they?

Yup - they are maximum screwy. Nope, yer cannot delete em. SOMETIMES
you get reductions by reapply a listtemplate of Nothing to style lines
that shouldn't have em.

Sometimes you can get reductions doing a cutten paste everything but
the last para.

My last hope for complete success in this area is to completely
rebuild a document using a macro :-(

Steve H

Steve Hudson , HDK List MVP
Wright Technologies Pty Ltd (Aus) EyeSpring - the future of graphics has been created.

Charles Kenyon

unread,
Nov 29, 2001, 1:26:22 AM11/29/01
to
Addendum, that procedure I sent earlier is run along with one that first
deletes all of the styles attached to the listtemplate.
--
Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://www.addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://www.addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
.
"Steve Hudson" <st...@wright.com.au> wrote in message
news:h18b0usfi5i7416ds...@4ax.com...

Charles Kenyon

unread,
Nov 29, 2001, 1:24:10 AM11/29/01
to
Hi Steve,

What is it that I am doing when I run the following code? Are the defined
list templates not deleted but merely unreferenced? The code was developed
in trying to write a macro to set up a set of styles and an outline list
template. I started by recording Dave Rado's instructions for manually
attaching a custom template to a set of styles and one of the things that he
said to do was to reset each of the templates that shows on the screen of
six. I am using the Count property to get the ones past the six displayed as
well.

Private Sub ResetListMacro()
'
' ResetListMacro Macro
' Macro written 11/19/01 by Charles Kyle Kenyon
' Resets Outline List Templates in document to base
'
' Declare Variables
Dim iCount As Integer
Dim iNumber As Integer ' Number of ListTemplates
'
' Get number of (outline) ListTemplates
iNumber = ListGalleries(wdOutlineNumberGallery).ListTemplates.Count
'
' Reset all ListTemplates to system clear
For iCount = 1 To iNumber
ListGalleries(wdOutlineNumberGallery).Reset iCount
Next iCount
'
' Clear Variables declared in this procedure - may not be necessary
iCount = Empty
iNumber = Empty
End Sub

What is the difference between resetting a list template and deleting it?
--
Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://www.addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://www.addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Steve Hudson" <st...@wright.com.au> wrote in message
news:h18b0usfi5i7416ds...@4ax.com...

Ian Sharpe

unread,
Nov 29, 2001, 3:51:32 AM11/29/01
to
Thanks for the response,
I'll try it out, and let you know.

The goal is to develop an analyser that will strip the garbage out of
documents, and set up proper definitions for the lists that remain.
It appears that I am only one of many innocents who tread this path warily,
not knowing where, when or how the next obstacle will appear.

:o)

"Charles Kenyon" <keny...@remove.no.spam.addbalance.com> wrote in message
news:ubiIJ6JeBHA.2196@tkmsftngp04...

Andrew Gabb

unread,
Nov 29, 2001, 8:29:34 AM11/29/01
to
I only know that under some conditions unused LTs are deleted by the
Word 97 Leap Year patch when you save the document (and you set a
parameter in your registry).

Andrew

--
Andrew Gabb
email: ag...@tpgi.com.au Adelaide, South Australia
phone: +61 8 8342-1021, fax: +61 8 8269-3280
-----

Ian Sharpe

unread,
Nov 29, 2001, 11:05:25 AM11/29/01
to
There seems to be a subtle difference between the two collections:
Application.ListGalleries(n).ListTemplates
and
ActiveDocument.ListTemplates

I want to be able to eliminate a specific ListTemplate, not just clear down
the lot.

The help describes ListTemplates as being decendent from "Multiple Objects",
surely this can't mean that
they are capable of having more than one parent object !
I thought I might be able to trace a template to a gallery using the .parent
property, but I have been unable to use the .parent property to discover
what the parent object is. I'll keep you posted if I crack it.


"Charles Kenyon" <keny...@remove.no.spam.addbalance.com> wrote in message
news:ubiIJ6JeBHA.2196@tkmsftngp04...

Cindy Meister -WordMVP-

unread,
Dec 10, 2001, 9:12:25 AM12/10/01
to
Hi Ian,

> You can Add your own template using VB, or let Word add one for you whenever
> you modify a list.
> So how do they get cleaned out when they are no longer used.
>

MS hasn't provided this functionality in the VBA interface. But the patch referred to in Andrew's message
is now part of Word 2002 (and one of the 2000 patches - SR2 I think - as well). This means that, when the
number of ListTemplates in a doc reaches a certain limit, unused ones will be deleted.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not
by e-mail :-)

Ian Sharpe

unread,
Dec 11, 2001, 3:26:19 AM12/11/01
to
This sounds more like a "quick fix" workaround to stop it crashing rather
than providing a better control mechanism, or the tools to manage it.

Ian

"Cindy Meister -WordMVP-" <CindyM...@swissonline.ch> wrote in message
news:VA.000050c7.00afc321@speedy...

Cindy Meister -WordMVP-

unread,
Dec 11, 2001, 7:10:49 AM12/11/01
to
Hi Ian,

> This sounds more like a "quick fix" workaround to stop it crashing rather
> than providing a better control mechanism, or the tools to manage it.
>

No argument, there. I'm just supplementing the info in this thread :-)

About all you can really do is send an email to msw...@microsoft.com,
requesting the functionality. Be very specific about what you want, why
it's necessary, and the business impact (generally, not just for you).

Steve Hudson

unread,
Dec 14, 2001, 1:47:32 AM12/14/01
to
Reseting a listtemplate returns it to its default values.
Occassionally it APPEARS to have deleted (but it could have been
something else I was doing at the time) an orphaned
activedocument.listtemplate.


Anyways, the main reason for your confusion, I think, is there are TWO
sets of listtemplates. (I will try and keep this light and fluffy)

One set is in the Galleries (Bullet and Numbering dialog). You are
mucking with these in your code below. These are "system" settings,
stored in the registry. My GUESS is the registry entry points to the
style offset, thus changing your style lists will corrupt lists that
aren't based on default styles.

Now, when you actually APPLY a list style to the document, Word very
badly attempts to do this:

1) Determine whether this style's listtemplate has an instance in the
document already. For built-in list styles the listtemplate gets the
same "name" (virtual, not actually available to the VBA user) as the
style so they are a bit safer to use.

2) If it has, link to that. If it hasn't, copy the gallery entry to
the document and link to it.

My gut feeling is that the manual list restart adds a new
characteristic to the list, so adding a new list of same style after
restarting an old one will just about always add a redundant list -
but I havent tested this fully yet.

So, your code takes all the liddle entries in the Bullets and
Numbering dialog and returns them to original, installed settings - a
very wise piece of advice to follow before setting your own tweaks in
place for a number of reasons. It doesn't do boo to any listtemplates
that have been stamped down into the document.

These are the troublesome listtemplates that eventually cause your
document to go belly-up. They cannot be deleted, and resetting them
just screws your document up. They are "attached" to various paramarks
throughout the document. As the listtemplates collection belongs to
either the Galleries or the Activedocument, there is no way to tell
its binary offset and thus its rough location in the doc.

However, if you do find the para it is attached to, copy the para
MINUS the para mark to the new doc, and problem solved. I will be
wrapping a lot of this technology up shortly in a Rebuild! template.

Steve H (sorry for the length, its a bitchin complex subject)

Steve Hudson , HDK List MVP
Principal Technical Writer

Steve Hudson

unread,
Dec 14, 2001, 1:49:21 AM12/14/01
to
This is kinda amusing - the easiest way to clear out excess
listtemplates is to keep adding them until the count magically drops
??? :-)

Steve

Steve Hudson , HDK List MVP

Charles Kenyon

unread,
Dec 14, 2001, 3:09:02 PM12/14/01
to
Thank you for the clarification.
--
Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://www.addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://www.addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Steve Hudson" <st...@wright.com.au> wrote in message

news:jb7j1u4qej4altmh3...@4ax.com...

Cindy Meister -WordMVP-

unread,
Dec 17, 2001, 2:51:34 PM12/17/01
to
Hi Steve,

> This is kinda amusing - the easiest way to clear out excess
> listtemplates is to keep adding them until the count magically drops
> ??? :-)
>

Yeah, I know. That was my reaction, too :-) <hold-head-and-groan>

-- Cindy

0 new messages