Solved

VBA - modify outline numbering in Word

Posted on 2010-08-30
5
918 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
  • 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

Suggested Solutions

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.

856 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