Ending a list

R

Rhino

I'm gradually getting to the end of my ambitious macro but I've just hit a
problem I can't figure out: how do I end a List?

My macro is writing a simple one-level bulleted list with the following
code:

------------------------------------------------------------------------------------------------------
'Describe the list that should be written
ListGalleries(wdBulletGallery).ListTemplates(1).name = ""
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1), ContinuePreviousList:=False,
ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior

'Split the list into an array
experienceString = resumefilevalue
experienceArray = Split(experienceString, ";", -1, vbTextCompare)
sizeExperienceArray = UBound(experienceArray) + 1
Do Until counter = sizeExperienceArray
If (experienceArray(counter) <> "") Then
Selection.TypeText experienceArray(counter)
Selection.TypeParagraph
End If
counter = counter + 1
Loop
------------------------------------------------------------------------------------------------------

The list is written just fine but the problem is that everything that
follows the list in the document has a bullet in front of it as if all of
the subsequent lines are further items in this list.

Apparently, I need to do something to indicate that the list has ended and
that subsequent text in the document is not part of the list. Unfortunately,
after a couple of hours poking around trying to figure out how to end the
list, I haven't found anything that works. I can't find the answer in the
help but that's not too surprising: I'm not sure what I should use for a
search question! I've tried a bunch of things via trial and error but to no
avail.

Can anyone tell me what I need to do to end the list? And for bonus points,
maybe you can tell me how I could have figured this out for myself?
 
D

Dave Lett

Hi Rhino,

The RemoveNumbers method "Removes numbers or bullets from the specified
Document, List, or ListFormat object." So, after you complete your list, you
can type another paragraph and then perhaps use something like the following:

Selection.Range.ListFormat.RemoveNumbers

HTH,
Dave
 
R

Rhino

Thanks Dave!

I just made Selection.Range.ListFormat.RemoveNumbers the line after I
finished writing my list and each list ended itself perfectly.

I'm glad I asked this question: I never would have guessed this solution and
I doubt I would have stumbled on it in the help or via trial and error. So
far, I'm not finding the solutions to some problems very intuitive. Maybe
things will seem more obvious after I've done some more macros and learn
more about what the different objects do....

Thanks again!

Rhino
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top