Updates Styles Problem

R

Rhett Oswald

Hi
I have created a template using the styles H1, H2, H3 for headings and
Normal for body text all with Times New Roman 12 point.

Users type up there document using the above template then copy &
paste the contents into a Web Authoring program (Farcry) for inclusion
on an intranet. To keep things simple we run a style sheet to format
the intranet pages.

The problem is if the users have existing documents that have been
created using other styles, when they paste them into the template the
other styles are included, is there a way that I can automatically
convert styles that are not Normal into normal (TNR 12 point).

My VBA is mediocre but enough to understand variables, loops, ifs,
data types etc.

Thanks if anyone can help

rhetto
 
J

Jezebel

There are several methods you could use, depending on the detail of what
you're trying to achieve. Possibly simplest would be to iterate the
paragraphs, and change the style that way --

Dim pPar as Word.Paragraph
For each pPar in ActiveDocument.Paragraphs
select case pPar.Format.Style
Case "Heading 1"
pPar.Format.Style = "H1"
Case ...
:
Case else
pPar.Format.Style = "normal"
end select
Next
 

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