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 / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Ending a list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rhino - 30 Jan 2006 20:47 GMT
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?

Signature

Rhino

Dave Lett - 31 Jan 2006 13:48 GMT
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

> 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?
[quoted text clipped - 37 lines]
> 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?
Rhino - 31 Jan 2006 21:15 GMT
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

> Hi Rhino,
>
[quoted text clipped - 56 lines]
>> points,
>> maybe you can tell me how I could have figured this out for myself?
 
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.