Solved

VBA - modify outline numbering in Word

Posted on 2010-08-30
5
919 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

726 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