Programatically set numbering style

S

Sanya Ibrahim

Hello all, I want to set the paragraph numbering style of new Word 2007
documents as below:

1. Text

2. Text

(a) Text

(b) Text

I am able to set the numbering of the paragraphs, but not able to set the
space between paragraphs and numbering style for the sub-paragraphs. One
reason is that I am not able to recognise if the new paragraph is a
sub-paragraph.

Can anyone help me?

Sanya
 
D

Doug Robbins - Word MVP

You should define the Styles in the template and then apply the Styles as
required.

To learn how to define the numbered Styles properly, see the following page
of fellow MVP Shauna Kelly's website:

http://www.ShaunaKelly.com/word/numbering/OutlineNumbering.html

If you need to know how to create a template to hold your numbering scheme,
see:

Creating a Template - The Basics (Part I)
http://www.word.mvps.org/FAQs/Customization/CreateATemplatePart1.htm

Creating a Template (Part II)
http://www.word.mvps.org/FAQs/Customization/CreateATemplatePart2.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
S

Sanya Ibrahim

Thanks a lot. Sorry, but I really missed to mention that I wanted to do this
in VBA.
 
D

Doug Robbins - Word MVP

Why wouldn't you create a template to be used as the basis of the new
documents that you want to create?

It is then a simple matter to use vba to create a new document from that
template and insert text into the document and apply the relevant styles to
it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
S

Sanya Ibrahim

Thanks for that. That sounds more practical. Just one question though; is it
possible for me to create a number of templates and list them in a form
combobox? I actually wanted to do something similar to that initially.
Sanya
 
D

Doug Robbins - Word MVP

Yes, that can certainly be done.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
S

Sanya Ibrahim

Thanks.
One last question. How do I get the list of templates? Do I create the
templates and save them in a location or is there a default location where
all the templates are saved. (I found a lot of queries in the web regarding
the location of Word 2007 templates). How do I retrieve the list of
templates?
Sanya
 
D

Doug Robbins - Word MVP

You could put all of the applicable templates in a separate folder and then
use code similar to that in the following article to get the names of them

See the article "Insert into a document the names of all files in a selected
folder†at:

http://www.word.mvps.org/FAQs/MacrosVBA/InsertFileNames.htm

For loading the names into a listbox or combobox, See the following page of
Greg Maxey's website :

http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 

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