Wednesday 15 June 2011

excel vba - VBA: How to start and end a list, bulleted or numbered, in Word? -



excel vba - VBA: How to start and end a list, bulleted or numbered, in Word? -

i can't figure out how vba start bulleted list in word. i've got code types out stuff word, can font , paragraph formatting, no problem, want create bulleted list. i've found next code,

listformat.applylisttemplate listtemplate:=listgalleries(wdbulletgallery).listtemplates(2)

which should create bulleted list of sec standard type, can determine utilize 'range' command causes entire document have list applied it. i'd have applied new line i'm having code type, , then, @ point, able turn list off, able go on without list beingness applied.

thanks!

this link should help query:

vba - bullet points

basically code applies selection:

selection.range.listformat.applybulletdefault

and code adds selected paragraph number (in case paragraph 2):

documents("mydoc.doc").paragraphs(2).range.listformat _ .applybulletdefault

this code applies bullet points range of paragraphs:

set mydoc = activedocument set myrange = mydoc.range( _ start:= mydoc.paragraphs(3).range.start, _ end:=mydoc.paragraphs(6).range.end) if myrange.listformat.listtype = wdlistnonumbering myrange.listformat.applybulletdefault end if

assuming know text beingness added, can utilize sec example. if don't know how many paragraphs beingness added, each time create new one, increment integer 1 , utilize integer in 3rd example.

for example:

start:= mydoc.paragraphs(2).range.start, _ end:=mydoc.paragraphs(i).range.end)

excel-vba ms-word

No comments:

Post a Comment