Formatting/Styles

M

major

I am not sure if I am at the right place for this.

I am very new to VBA. I am trying to automate the following. I have word
document with headings/body text/tables etc. For ex:
--heading1
-----heading2
---Body Text
-- Table
-- Bullets
I want to write a macro that will run through the entire content and apply
styles accordingly. So it will go through the document and decide if its
heading 1 apply heading 1 style, if heading 2 apply style, if table apply
table style and if text apply body text style.

Can someone lead my way to this? If it is possible to do? I just need start
and I can follow it through..Many thanks in advance.
 
J

Jean-Guy Marcil

major was telling us:
major nous racontait que :
I am not sure if I am at the right place for this.

I am very new to VBA. I am trying to automate the following. I have
word document with headings/body text/tables etc. For ex:
--heading1
-----heading2
---Body Text
-- Table
-- Bullets
I want to write a macro that will run through the entire content and
apply styles accordingly. So it will go through the document and
decide if its heading 1 apply heading 1 style, if heading 2 apply
style, if table apply table style and if text apply body text style.

Can someone lead my way to this? If it is possible to do? I just need
start and I can follow it through..Many thanks in advance.

How will the macro know that the currently examined paragraph is a paragraph
to which "Heading 1" should be applied? The same for Heading 2, body text,
and so on. The only one I can see that can be done from the description you
provided is the table. Word can go through each table, apply a style to the
first row/column and another in the other cells...

So, give us more details...!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
[email protected]
Word MVP site: http://www.word.mvps.org
 
M

major

Thanks for your response. Yah, I was hoping there was an easier way to
differentiate headings from body text in paragraph. The text we have are in
paragraphs. There is no way for a program to tell whether it's a heading or
body text. I suppose I could loop through all paragraphs and add
user-interaction of some sort to ask what type of style preferred. I was just
curious if there was any other way of doing it.

Basically I want to be able to mass apply a style on certain different
chunks of data in document. I could use bookmarks to mark sections and apply
format on range. But then I don't want to be inserting lots of bookmarks..any
other ideas to do this?
How does outline work?

We have templates that has styles already set-up and headings written out.
We distrubute these templates to users to fill in content in specific
sections based on headings. When we get the document back the format is often
messed up, through copy and paste etc. The point of my macro was to act as
post-format to ensure all styles were applied and not modified.

And I didn't know how I would be able to differente diff sections (headings
vs text)
 
Top