Option Explicit Sub Exemple() Dim Rng As Range, Car As Range, Déb As Long, Fin As Long, r As Long, Msg As String Set Rng = Selection.Range With Rng Déb = .Start Fin = .End End With Msg = "" For r = Déb To Fin With ActiveDocument Set Car .Range(r, r + 1): Msg Msg & Car.Text & vbCrLf End With Next r MsgBox Msg End Sub
Dim c As Variant
Par As Paragraph
Rng As Range
Set Rng = Par.Range
Cars As Characters
Set Cars = Rng.Characters
Car As Range
Set Car = Cars(r)
'MeF des commentaires Dim c As Variant Dim Par As Paragraph Dim Rng As Range 'Liste des caractères du paragraphe Dim Cars As Characters 'Cars représente la collection des caractères du paragraphe Set Rng = Par.Range Set car = Cars(c) Selection.MoveUp Unit:=wdParagraph, Count:=1 Selection.Find.ClearFormatting ' For Each c In Paragraphs(1).Range 'je voudrais faire une boucle ' For Each c In Paragraph For Each c In Paragraph 'pour chaque c dans le paragraphe en cours If c.Text "^l'" Or c.Text "^t'" Then 'alors sélection de la ligne entière ou mieux jusqu'au prochain ^l Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.Font.Size = 9.5 Selection.Font.Bold = wdToggle 'arrêt de la sélection Selection.EndKey Unit:=wdLine Exit For 'quitte la boucle
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionSet Rng = Par.Range
For Each c In Paragraph ....................... Next c
Dim c As Range, r As Long For r = 1 To Paragraphe.Range.Characters.Count Set c = Paragraphe.Range.Characters(r) ...................................... Next r
Dim c As Range, r As Long For r = 1 To Paragraphe.Range.Characters.Count Set c = Paragraphe.Range.Characters(r) 'pour chaque c dans le paragraphe en cours Selection.MoveUp Unit:=wdParagraph, Count:=1 Selection.Find.ClearFormatting If c.Text "^l'" Or c.Text "^t'" Then 'alors sélection de la ligne entière ou mieux jusqu'au prochain ^l Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.Font.Size = 9.5 Selection.Font.Bold = wdToggle 'arrêt de la sélection Selection.EndKey Unit:=wdLine Exit For 'quitte la boucle End If Next rau motif erreur 424 - Objet requis.
For Each c In Paragraph ....................... Next c
For r = 1 To Paragraph.Range.Characters.Count'erreur 424 - Objet requis.
je voudrais faire une boucle pour chaque c dans le paragraphe en cours