Retrieving Previous Level Number from heading style

R

Rusty

I used to have some very useful WordBasic macros that I am
now in the process of converting to VBA. Most of the code
converts to VBA well but I am stumped with how to get the
setting for including the number of the previous heading
level for a nominated built-in heading style.

For example, if the Heading1 style uses Arabic numbering
(e.g. 1, 2, 3), I want to be able to determine whether the
Heading2 style is set include the number of the Heading1
style in its numbering (e.g. 1.1, 1.2, 1.3, 2.1, 2.2, 2.3).

This was done with the Include parameter in Wordbasic. The
converted (to VBA) code looks like thisL

'Get include value from H2
Dim FHN As Object: Set FHN =
WordBasic.DialogRecord.FormatHeadingNumber(False)
FHN.Level = 2
WordBasic.CurValues.FormatHeadingNumber FHN
H2IncludePreviousNumber = FHN.include

'Set include value for H2
WordBasic.FormatHeadingNumber
include:=H2IncludePreviousNumber

Interestingly, while I cannot retrieve the include value
I can set it using the above method.

I am quite happy to relinquish the old Wordbasic code but
I cannot for the life of me find out how to do what I want
with VBA.

All suggestions gratefully accepted.
 
W

Word Heretic

G'day "Rusty" <[email protected]>,

Try mucking around with .Range.ListFormat.ListString and friends.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Rusty reckoned:
 
R

Rusty

Thanks for that suggestion.

On reflection, I could have asked my question a little
more clearly.

What I want to know is, using VBA, how can you extract
from a nominated heading style whether that heading level
is set to have the numbers of preceding heading levels
added to it.

That is, what is the setting that specifies that the
Heading 2 style should include the number of the Heading 1
style? This isn't a particular number or a numbering style
but a Yes or No to include numbering from a previous level.

The Microsoft advice on equivalent Wordbasic - VBA
functions says that you should use "ListGalleries
(WdListGalleryType).ListTemplates(num).ListLevels(num)" in
place of the old Wordbasic FormatHeadingNumber command but
I can't see how it can provide what I want.

Cheers.
 
W

Word Heretic

G'day "Rusty" <[email protected]>,

That ListLevel object has STACKS of properties and methods that hold
EVERYTHING about the list.

Normallly I do this:

Name all list templates in the doc.
Find yer para of interest, get the listtemplate in use
Look up the .ListTemplates(1).ListLevels(3).NumberFormat
Each level is then repp'd by %1.%2.%3 for eg.



Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Rusty reckoned:
 
R

Rusty

Many thanks Steve.

Cheers.
-----Original Message-----
G'day "Rusty" <[email protected]>,

That ListLevel object has STACKS of properties and methods that hold
EVERYTHING about the list.

Normallly I do this:

Name all list templates in the doc.
Find yer para of interest, get the listtemplate in use
Look up the .ListTemplates(1).ListLevels(3).NumberFormat
Each level is then repp'd by %1.%2.%3 for eg.



Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Rusty reckoned:


.
 

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