MarieHelene
Programmer
Hi eveyone!
This is my code (with parts in french, sorry):
-----------------------------------------------------------
'tant qu'on n'est pas à la fin du fichier, répéter...
'Do While Not EOF(???)
'Do While Not ActiveDocument.Bookmarks("\EndOfDoc")
'recherche d'un paragraphe en "Heading 4"
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 4")
With Selection.Find
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
doublon = Selection.Text
'comparaison avec le texte de la ligne suivante
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.MoveLeft Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
If Selection.Text = doublon And Selection.Style = "Heading 5" Then
Selection.Delete
End If
Loop
----------------------------------------------------------
I need to execute this code (deletion of one of two consecutive repeated lines of text, first line with style "Heading 4", second line with style "Heading 5") from the start to the end of file.
My problem is... what do I have to write after "Do While"?...
Is there a way to get the filenumber of the "ActiveFile" (or to set it) to use with EOF(filenumber)?
If I can use bookmarks ("\EndOfDoc"), how?...
Or maybe is there an easier or simplier way to loop?...
Thank you. ;-)
This is my code (with parts in french, sorry):
-----------------------------------------------------------
'tant qu'on n'est pas à la fin du fichier, répéter...
'Do While Not EOF(???)
'Do While Not ActiveDocument.Bookmarks("\EndOfDoc")
'recherche d'un paragraphe en "Heading 4"
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 4")
With Selection.Find
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
doublon = Selection.Text
'comparaison avec le texte de la ligne suivante
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.MoveLeft Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
If Selection.Text = doublon And Selection.Style = "Heading 5" Then
Selection.Delete
End If
Loop
----------------------------------------------------------
I need to execute this code (deletion of one of two consecutive repeated lines of text, first line with style "Heading 4", second line with style "Heading 5") from the start to the end of file.
My problem is... what do I have to write after "Do While"?...
Is there a way to get the filenumber of the "ActiveFile" (or to set it) to use with EOF(filenumber)?
If I can use bookmarks ("\EndOfDoc"), how?...
Or maybe is there an easier or simplier way to loop?...
Thank you. ;-)