Cannot create bulleted style using VB

D

David Cleave

Hi all

I’m having a nightmare trying to create a simple bulleted style using Visual
Basic. I have added a new style of type wdStyleTypeList. Then I get an error
from the following line:

MyStyle.ListTemplate.ListLevels(1).NumberStyle = wdListNumberStyleBullet

The error is 4608: ‘value out of range’.

Can anyone advise what the problem is? Is this not the way to create a
simple bulleted list style?

Many thanks

David
 
C

Charles Kenyon

See: http://www.shaunakelly.com/word/bullets/controlbullets.html

You want to set up styles using the methods shown. Does your code do this?

If so, post your code if you want help with it.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
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.
 
D

David Cleave

Thank you for your reply Charles. That website you mentioned is excellent -
probably the best application tutorial site I've seen.

I'm pretty much familiar with setting up Outline Numbered styles in Word. It
really couldn't be more complicated. And I think in using VB to create a
bulleted style, I am following the same procedure using code.

However, I don't know why it's not working. Here is all the code I am using
to define my style, which is called 'TIM List Bullet'. [AandO is a
Word.Document object.]

AandO.Styles.Add Name:="TIM List Bullet", Type:=wdStyleTypeList
With AandO.Styles("TIM List Bullet")
.Font.Name = Arial
.Font.Bold = False
.Font.Italic = False
.Font.Size = 11
.ListTemplate.ListLevels(1).TabPosition = AppWord.CentimetersToPoints(1)
.ListTemplate.ListLevels(1).TextPosition = AppWord.CentimetersToPoints(1)
.ListTemplate.ListLevels(1).NumberStyle = wdListNumberStyleBullet
.ListTemplate.ListLevels(1).Alignment = wdListLevelAlignLeft
End With

The IDE is highlighting the line:

..ListTemplate.ListLevels(1).NumberStyle = wdListNumberStyleBullet

saying 'value out of range'.

Any ideas what's going on?

Thanks again

David
 

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