detecting unwanted formatting

J

John Devlon

Dear All,

Working on a project I encountered some problems ...

I need to develop some vba code to check documents if the are well formated.

The text in the document may only be formatted with character- and
paragrapgh styles i've designed.
I've also created a charachter style "bad formated". I need to apply this
style to all pieces of text that are nof formated with the styles of my
chooice, even the pieces of text that have the right paragraph style but
also have been set to "bold" or "underlined" or something else ...

I also need to find and change all bad quotes (") and change them to "smart"
quotes ...

Has anyone have some idees ... Does know were i can find this on the web ?

Thank you very much in advance ....

High regards,

JD
 
J

John Devlon

Hi,

Thanx for your reply...

I've tested the build in features you mentioned but it does not work well.

Also, the VBA code I'm trying to develop and I'm looking for, will be used
in Word prior to 2003.



JD
 
J

John Devlon

Dear Jezebel,

Many thanx for your feedback...

I already developed some basic code ... And this works fine... Afcourse this
has to be extended...
One thing i noticed is that when paragraph styles are mixed with character
formating, the code does not detect any mistakes... Do you have any
suggestions how i can detect these occurenses ... I can not find any
'undefined' ...

Thanx

John


Sub Controle_Styles()
Dim Sty1 As String
Dim bolFound As Boolean
bolFound = False

Dim acceptedStyle(10) As String
acceptedStyle(1) = "[text]"
acceptedStyle(2) = "[ht]"
acceptedStyle(3) = "[t1]"

For Each para In ActiveDocument.Paragraphs
Sty1 = para.Style

For i = 0 To UBound(acceptedStyle)
If acceptedStyle(i) = Sty1 Then
bolFound = True
End If
Next

If bolFound = False Then
para.Style = ActiveDocument.Styles("[FOUT]")
End If

bolFound = False

Next para

End Sub
 

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