Collapse column

Autor Thema: Office 2010: macro in definiertem Bereich  (Gelesen 1184 mal)

Offline Dominik9020

  • Newbie
  • *
  • Beiträge: 1
    • Profil anzeigen
  • Office-KnowHow: Experte
  • VBA-KnowHow- : Mittelmäßig
  • Version [Office] : Office 2010
Office 2010: macro in definiertem Bereich
« am: Juni 24, 2014, 15:29:45 Nachmittag »
Hallo zusammen

Ich habe jetzt schon ewig gesucht und finde einfach keine Lösung.
Ich habe Worddokumente mit ca 10 Seiten. das Makro (siehe unten) soll nur aueiner Seite die Formatierung anpassen. wie kann ich den Bereich einschränken, damit nicht auch der Rest des Dokuments formatiert wird.

Zeilen Makro
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.ParagraphFormat.TabStops.ClearAll
    Selection.Find.Replacement.ParagraphFormat.TabStops.Add Position:= _
        CentimetersToPoints(5), Alignment:=wdAlignTabLeft, Leader:= _
        wdTabLeaderSpaces
    With Selection.Find
        .Text = "^t^p^t"
        .Replacement.Text = "^t"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    ActiveWindow.ActivePane.VerticalPercentScrolled = 0
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.ParagraphFormat.TabStops.ClearAll
    Selection.Find.Replacement.ParagraphFormat.TabStops.Add Position:= _
        CentimetersToPoints(5), Alignment:=wdAlignTabLeft, Leader:= _
        wdTabLeaderSpaces
    With Selection.Find
        .Text = "^t^p^t"
        .Replacement.Text = "^t"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    ActiveWindow.ActivePane.VerticalPercentScrolled = 0
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.ParagraphFormat.TabStops.ClearAll
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    ActiveWindow.ActivePane.VerticalPercentScrolled = 13
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.ParagraphFormat.TabStops.ClearAll
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    ActiveWindow.ActivePane.VerticalPercentScrolled = 0
End Sub

Keine Lösung gefunden? Du kannst Dich gerne an unser erfahrenes Experten-Team wenden und Dein Anliegen in Auftrag geben.
>>> Schnell und einfach ein unverbindliches Angebot anfordern. Per E-Mail an anfrage@excel-inside.de oder per Online-Formular
<<<

!!! Wichtige Information
!!! Dieses Forum steht aus technischen Gründen ab dem 11. September 2019 nur noch im Lesemodus zur Verfügung.
Das NEUE Office-Fragen-Forum kannst du aber unter der gewohnten Domain https://office-fragen.de wie gewohnt nutzen.

- Wir freuen uns auf deinen Besuch im neuen Forum.