Determine the FULL paragraph style in Word

Posted on 2007-10-15
Last Modified: 2008-03-06
Hi experts,

I'm using a VBA macro to collect information on the paragraph style.  It uses a line like this:

Dim para as paragraph
Dim strStyle as string
Dim arrStyles() as string
Dim i as long

i = 0
For each para in activedocument.paragraphs
  i = i + 1
  arrStyles(i) =
next para

That works fine.  However, it records the short version of the paragraph style, for instance:
If the first paragraph is "Header 1" it records "Header 1" in my array.  Good.
But if the first paragraph is "Header 1 + 10pt" it records "Header 1" in my array. Bad.
It always records the short version and never the full one that takes account of user changes.

So my question for all you experts, Is there any way to capture the full name of the style that is actually used as a string.  In other words, how can I get it to say "Header 1 + 10pt" if that is what the style has become?

Thanks in advance for any advice you can offer.


Question by:PatternNut
    LVL 76

    Expert Comment

    Use the description property

    arrStyles(i) = para.Style.Description

    Author Comment

    Hi Graham, it has been a while!  I learned so much from all of your tips that I have had very few queries!

    However, I'm afraid this one doesn't seem to solve it.  Or maybe it just needs a little more info.  For the same paragraph, the commands return the following: = "Heading 2" = "Normal + Font: Bold, Indent: Left: 0 Cm Hanging: 1.02cm, tabs: 1.02cm, list tab (etc - it goes on for ages)

    And the box in word says: Heading 2 + 11pt

    Any ideas?


    LVL 76

    Accepted Solution

    The problem is that those the details list character formatting where it differs from the character formatting already associated with the paragraph style.

    There can be several of these which can apply to all or part of the paragraph.

    I don't think that any of the style properties returns the list, so we may have to analyse the paragraph a character at a time.

    Author Comment

    Hi Graham,

    I don't think that's quite right... I think description is the formatting of the style... and therefore doesn't change when the box says Heading 2 + 11pt. or Heading 2 + Not bold, etc.

    But I'm awarding the points anyway because this was a very helpful answer and I really appreciate how much thought you put into this.

    Thank ye sir,


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    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…
    Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
    This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
    Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now