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 / February 2006

Tip: Looking for answers? Try searching our database.

bullet lists

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nathan Franklin - 22 Feb 2006 00:42 GMT
Hello,

could someone please point me in the right direction of how to create bullet
lists with vba??

Thanks
Nathan
Jezebel - 22 Feb 2006 01:30 GMT
Easiest method is to define a style (eg "Bullet"), then use myRange.Style =
"Bullet". It's possible to set up the bulleting itself via VBA (read help on
ListGalleries) but a) it's a lot of work, and b) it means your formatting is
hard-coded.

> Hello,
>
[quoted text clipped - 3 lines]
> Thanks
> Nathan
Nathan Franklin - 22 Feb 2006 03:49 GMT
Jezebel, thanks for your reply,

just had another question,
i try and insert each point like so
Dim CurrentSummaryIndex As Int16 = 1

Dim SummaryRange As Word.Range =
Doc.Bookmarks.Item("SignificantMattersSummaryPoints").Range

SummaryRange.Style = "List Bullet"

For Each rSummary In dSummary.Rows

SummaryRange.InsertBefore(dbNull(rSummary("SummaryPoint")))

If Not dSummary.Rows.Count = CurrentSummaryIndex Then

SummaryRange.InsertParagraphAfter()

SummaryRange.Collapse(Word.WdCollapseDirection.wdCollapseEnd)

'Exit For

End If

CurrentSummaryIndex += 1

Next

my problem is that when i try to appy an individual style to these items
(italics or bold) all of them chnge there style. Is there anyway around
this??

> Easiest method is to define a style (eg "Bullet"), then use myRange.Style
> = "Bullet". It's possible to set up the bulleting itself via VBA (read
[quoted text clipped - 8 lines]
>> Thanks
>> Nathan
Jezebel - 22 Feb 2006 04:54 GMT
Is the style set to update automatically?

> Jezebel, thanks for your reply,
>
[quoted text clipped - 41 lines]
>>> Thanks
>>> Nathan
Nathan Franklin - 22 Feb 2006 05:34 GMT
i think it might have been because the bookmark range was assigned on
particular style..??

i have fixed it though... after spending over 3 hours on it... I ended up
recording the macro from word and using the selection object

Some have said using the selection object is bulky and slow... I have run
tests on how long it takes to run the code and it ends up being less then
200ms. So im stoked...

for reference this is what i did...

Doc.Bookmarks.Item("SignificantMattersSummaryPoints").Select()

App.Selection.Style = "Normal"

App.Selection.Range.ListFormat.ApplyListTemplate(ListTemplate:=App.ListGalleries.Item(
_

Word.WdListGalleryType.wdBulletGallery).ListTemplates.Item(1),
ContinuePreviousList:=False, ApplyTo:= _

Word.WdListApplyTo.wdListApplyToWholeList)

For Each rSummary In dSummary.Rows

App.Selection.TypeText(dbNull(rSummary("SummaryPoint")))

If Not CurrentSummaryIndex = dSummary.Rows.Count Then

App.Selection.TypeParagraph()

CurrentSummaryIndex += 1

End If

Next

> Is the style set to update automatically?
>
[quoted text clipped - 43 lines]
>>>> Thanks
>>>> Nathan
Jezebel - 22 Feb 2006 05:44 GMT
Better and simpler would be ---

   with Doc.Bookmarks.Item("SignificantMattersSummaryPoints")
       .Style = "Normal"
       .ListFormat.ApplyListTemplate(ListTemplate:=App.ListGalleries.Item(  
...
   end with

>i think it might have been because the bookmark range was assigned on
>particular style..??
[quoted text clipped - 81 lines]
>>>>> Thanks
>>>>> Nathan
Nathan Franklin - 22 Feb 2006 23:56 GMT
hey jezebel...
this method didnt work...

the correct output is this...
·         summary point 1

·         summary point 2

·         summary point 3

·         summary point 4

·         summary point 5

this is what i get with the code you gave me...
·

·          summary point 5

i would likew to use ranges if i could, because they are faster right??

here is the middle part of the code..

For Each rSummary In dSummary.Rows

.InsertAfter(dbNull(rSummary("SummaryPoint")))

If Not CurrentSummaryIndex = dSummary.Rows.Count Then

.InsertParagraph()

CurrentSummaryIndex += 1

End If

Next

> Better and simpler would be ---
>
[quoted text clipped - 89 lines]
>>>>>> Thanks
>>>>>> Nathan
 
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.