How to tell if direct formatting is applied

A

Art H

Via VBA, how do I tell if direct formatting is applied? What property
do I interrogate to determine if direct character formatting and/or
paragraph formatting is applied?

I can see if direct formatting is applied (Distinguish style source is
checked) via the reveal formatting pane (Shift+F1) in Word 2003/2007.
I want to duplicate that knowledge via VBA. My goal, based on the type
of direct formatting applied, is to selectively remove direct
formatting and maybe apply a different document style (e.g., change
paragraph style from Normal to Body Text if left indent is 0).

I do not want to select the whole document and then reset character
and paragraph formatting as this will remove some necessary direct
formatting (e.g., lists created manually versus using a style). At
this stage of the document creation/modification, I don't have time to
do things right. Yes, I know.
 
C

Cindy M.

Hi Art,
Via VBA, how do I tell if direct formatting is applied? What property
do I interrogate to determine if direct character formatting and/or
paragraph formatting is applied?

As far as I know, VBA provides no way to determine this directly. The
only method I can think of would be to run through each property you
consider relevant and compare that to the applied Style definition to
see if it matches.
I can see if direct formatting is applied (Distinguish style source is
checked) via the reveal formatting pane (Shift+F1) in Word 2003/2007.
I want to duplicate that knowledge via VBA. My goal, based on the type
of direct formatting applied, is to selectively remove direct
formatting and maybe apply a different document style (e.g., change
paragraph style from Normal to Body Text if left indent is 0).

I do not want to select the whole document and then reset character
and paragraph formatting as this will remove some necessary direct
formatting (e.g., lists created manually versus using a style). At
this stage of the document creation/modification, I don't have time to
do things right.

Well FWIW when I need to "clean up" like that what I do is display the
"Styles" pane. I have it display the direct formatting and I select each
direct format entry. Right-click gives me the option to select all
ranges with that kind of formatting (and I can see how many there are).
So I can very quickly see if this is direct formatting I want to keep,
or if a style needs to be applied - and it can be applied very quickly
to the selected ranges.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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