-
Solved: Bible study
Hallo, I need help in my bible study.
I must format a text in this form:
1) Where there is a word write all in Capital Letters and bold characters.
Example:
EFREM replace with: <p><b>EFREM</b>
ARNOBIO IL GIOVANE replace with: <p><b>ARNOBIO IL GIOVANE</b>
GREGORIO NISSENO replace with:<p><b>GREGORIO NISSENO</b>
2) At the beginning of all paragraphs -where there are words- I must insert:
<p> (only if you haven't already write it previously completing number one).
Thanks Pasquale:dunno :dunno
-
Let me just get this straight...
You want code to search through a document, find text that is all caps and formatted bold, and if it meets that criteria, then surround it with the symbols you mentioned?
Then, after it's done that, it needs to look at the beginning of each paragraph. And if it didn't already place the symbols mentioned in the first step (i.e. if the paragraph starts without any symbols) then it should place a <p> at the start?
-
Hi, babydum
You have understund.
pasquale
-
Okay, Pasqual,
This is going to sound strange, but I don't have a clue how to do it. When I read your first post, it took me a while to understand, but now that it has been clarified, hopefully someone on this forum will be able to help.
Good luck.
-
Hi Pasquale,
Number 2. This should do it (mind you, I've said that before - LOL) ..
[VBA]
Dim Para As Paragraph
For Each Para In ActiveDocument.Paragraphs
If Len(Para.Range.Text) > 1 Then
If Left(Para.Range.Text, 3) <> "<p>" Then
Para.Range.InsertBefore "<p>"
End If
End If
Next[/VBA]
I'll be back with number 1.
-
Hi Tony,
it works very well.
thanks
pasquale
-
Hi Pasquale,
Back, as promised ... number 1
[VBA]
Selection.HomeKey wdStory
With Selection.Find
.ClearFormatting
.Font.Bold = True
.Text = "<*>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
While Selection.Find.Execute
If Selection.Text = UCase(Selection.Text) Then
Do
If Selection.End = ActiveDocument.Range.End Then Exit Do
If Not Selection.Next(wdWord, 1).Font.Bold Then Exit Do
If Selection.Next(wdWord, 1).Text <> UCase(Selection.Next(wdWord, 1).Text) Then Exit Do
Selection.MoveEnd wdWord, 1
Loop
Selection.InsertBefore "<p><b>"
Selection.InsertAfter "</b>"
End If
Selection.Collapse wdCollapseEnd
Wend[/VBA]
The HTML tags are sometimes bold, sometimes not - it's quite complex but I doubt you care so I haven't tried to sort it.
-
Hi Tony,
It works excellent.
I know what are VBA difficult.
I Know that for to realize this. is more complex.
And so i thanks thanks you.
pasquale