Einzelnen Beitrag anzeigen

Robert_G
(Gast)

n/a Beiträge
 
#5

Re: Word Makro zum markieren

  Alt 6. Feb 2004, 09:29
Ist doch ziemlich billig. Einfach mal auf Makro aufzeichnen klicken, Nach Font & Fontgröße suchen, Code abgucken, abändern...
2 min. anschauen & tippen :

Delphi-Quellcode:
Dim FirstPos, SecPos As Integer

FirstPos = -1
SecPos = -1

ActiveDocument.Range(0, 0).Select

Do While FirstPos = -1 Or SecPos = -1
    With Selection.Find
        .ClearFormatting
        .Font.Name = "Courier New"
        .Font.Size = 20
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    If Not Selection.Find.Found Then
     Exit Do
    End If
    
    If FirstPos = -1 Then
      FirstPos = Selection.Start
    ElseIf SecPos = -1 Then
      SecPos = Selection.Start
    End If
Loop

If FirstPos <> -1 And SecPos <> -1 Then
  Selection.Start = FirstPos
  Selection.End = SecPos
End If
  Mit Zitat antworten Zitat