?
Solved

VBA - modify outline numbering in Word

Posted on 2010-08-30
5
Medium Priority
?
933 Views
Last Modified: 2012-05-10
Hi Experts

I have various automatic paragraph numbering suites defined using Styles in a template.  More than one scheme may be used in a single document.  I want to modify the values for 'aligned at', 'tab space after' and 'indent at' for each of the suites programatically.  Please can you tell me how to go about it?  I just cannot work out how to get to modify those values.

I am using Word 2003.  Each schemes numbering settings are set from the first level Style and have a value in the 'ListNum' field.

Many thanks for your help.
0
Comment
Question by:MonteDelMar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 33566096
I'm not sure that I fully understand, but perhaps we could start here.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 33566098
I forgot the code:
Sub FormatNumbering()
    Dim lv As ListLevel
    Dim i As Integer
    
    With ActiveDocument.Styles("Style1").ListTemplate
        For i = 1 To 9
            Set lv = .ListLevels(i)
            lv.TextPosition = CentimetersToPoints(1)
            lv.TabPosition = CentimetersToPoints(1)
        Next i
    End With
    
End Sub

Open in new window

0
 

Author Comment

by:MonteDelMar
ID: 33679851
Hi Graham

I am sorry to have neglected to reply to you before now & am grateful for your help as ever.

Just to clarify my question:

I have created 9 Styles e.g. Lev1, Lev2 etc.

I choose Format Style & the Lev1 Styles and then choose Format Numbering and set up my paragraph numbering, linking each level to one of those 9 Styles.

I need to change some of the settings for each level.

The code you posted does allow me to change the settings.  If I run it then the numbering definitions reflect the changes.  However, the apperance of any text in the corresponding Style does not update, even when I block it & reset it (Ctrl+Q).  If I delete the existing text & type new, it still does not implement the changes made to the numbering definition.

I cannot find an option to change the 'aligned at' value either.

I feel as though I am missing something obvious and hoping that you can tell me what it is.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 33702894
I am trying to create your situation, but I cannot be certain that I am doing exactly what you are.

There is some modified code below. If it doesn't do what you need, could you post your document here, please, so that I can be sure that we are talking about the same thing?

Meanwhile, if you haven't already seen it, you might be interested in this article.

http://word.mvps.org/faqs/numbering/NumberingExplained/ApplyingNumbering/StyleBasedNumbering.htm
0
 

Author Closing Comment

by:MonteDelMar
ID: 33723837
Hi Graham

I think that there may have been some corruption in the document.  Unfortunately I cannot post it but the code you suggested certainly did alter the settings mentioned even though it was not reflected in the appearance of the document.  

Thank you for your help.

0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question