![]() |
|
|
![]() |
|||||||||||||
![]() |
||||||||||||||||
|
![]() |
#1 |
Registriert seit: 31.05.2004
Ort: D-NRW
Beiträge: 2.333
|
Hilfe zu If Funktion in Word (VBA) benötigt
Ich habe folgende Problemstellung:
Innerhalb eines Word 2003 Dokumentes möchte ich nach jeder Überschrift 2ter Ebene (bis auf die erste Überschrift) einen Zeilenumbruch oberhalb durchführen. Mein Code sieht bisher so aus: Code:
y = 0 'Anzahl vorhandener Überschriften 2.Ebene ya = 0 'Anzahl aller vorgenommenen Seitenumbrüche With ActiveDocument.Content.Find 'Ermittlung aller vorhandenen Überschriften 2.Ebene .ClearFormatting .Style = wdStyleHeading2 Do While .Execute(FindText:="", Forward:=True, Format:=True) = True y = y + 1 Loop End With Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1" 'Zu 1. Seite des Dokumentes wechseln For i = 0 To y Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles(wdStyleHeading2) With Selection.Find .Forward = True .Wrap = wdFindContinue .Format = True End With If i > 0 Then Selection.Find.Execute With Selection.ParagraphFormat .PageBreakBefore = True ya = ya + 1 'für interne Zählung aller durchgeführten Umbrüche End With End If Next i Code:
If i > 0 Then Selection.Find.Execute With Selection.ParagraphFormat .PageBreakBefore = True End With End If ![]() Kann mir da jemand einen Tip geben?
__________________
Gruß aus NRW Stefan |
![]() |
![]() |
Sponsored Links | |
|
|
|