Indexing mit Word: Makrocodes, Teil 2

Contents

Verschiedene weitere Makrocodes

In Teil 1 werden die Makrocodes aus Kapitel 6.12 gezeigt. Makros zum Thema „Seitenbereichsangaben“ sind in Teil 3 zu finden.

Sub querverweis()


‚ Makro zum Einfügen der Querverweis-Syntax in einem XE-Feld; Makro wurde aufgezeichnet und nicht nachbearbeitet; zur Makroausführung muss sich der Cursor am Ende des XE-Feldes befinden

Selection.TypeText Text:=“\t „“siehe „““
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End Sub
–––––––––––––––––

Sub textmarke_in_xe_feld()


‚ Makro zum Einfügen der Textmarken-Syntax in einem XE-Feld; Makro wurde aufgezeichnet und nicht nachbearbeitet; zur Makroausführung muss sich der Cursor am Ende des XE-Feldes befinden

Selection.TypeText Text:=“\r „““““
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End Sub
–––––––––––––––––

Sub index_dina4_2spaltig()


‚ Makro zum Einrichten einer DIN-A4-Seite für einen zweispaltigen Index; Makro wurde aufgezeichnet und nicht nachbearbeitet; zur Makroausführung kann sich der Cursor irgendwo im Dokumenttext befinden

Selection.WholeStory
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = „“
End If
.NameFarEast = „“
End With
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = CentimetersToPoints(2.54)
.BottomMargin = CentimetersToPoints(2.54)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1.27)
.FooterDistance = CentimetersToPoints(1.27)
.PageWidth = CentimetersToPoints(21)
.PageHeight = CentimetersToPoints(29.7)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
With Selection.PageSetup.TextColumns
.SetCount NumColumns:=2
.EvenlySpaced = True
.LineBetween = False
.Width = CentimetersToPoints(7.64)
.Spacing = CentimetersToPoints(0.63)
End With
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or Active-Window. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHead-er
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
„FILENAME „, PreserveFormatting:=True
Selection.TypeText Text:=vbTab & vbTab
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
„PAGE „, PreserveFormatting:=True
With ActiveDocument.Styles(„Kopfzeile“).Font
.Name = „Arial“
.Size = 8
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
.Ligatures = wdLigaturesNone
.NumberSpacing = wdNumberSpacingDefault
.NumberForm = wdNumberFormDefault
.StylisticSet = wdStylisticSetDefault
.ContextualAlternates = 0
End With
With ActiveDocument.Styles(„Kopfzeile“)
.AutomaticallyUpdate = False
.BaseStyle = „Standard“
.NextParagraphStyle = „Kopfzeile“
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
–––––––––––––––––

Sub index_main_sub1_sub2_schrift()


‚ Makro zur Vergabe der Schrift Times New Roman in Größe 10 pt für einen Index, der separat angelegt wurde; Makro wurde aufgezeichnet und nicht nachbearbeitet; es wird davon ausgegangen, dass die Formatvorlagen für die Ebenen von HT, UT und UUT „main“, „sub1“ und „sub2“ heißen; zur Makroausführung kann sich der Cursor irgendwo im Dokumenttext befinden

With ActiveDocument.Styles(„Main“).Font
.Name = „Times New Roman“
.Size = 10
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
.Ligatures = wdLigaturesNone
.NumberSpacing = wdNumberSpacingDefault
.NumberForm = wdNumberFormDefault
.StylisticSet = wdStylisticSetDefault
.ContextualAlternates = 0
End With
With ActiveDocument.Styles(„Main“)
.AutomaticallyUpdate = False
.BaseStyle = „“
.NextParagraphStyle = „Main“
End With
With ActiveDocument.Styles(„Sub 1“).Font
.Name = „Times New Roman“
.Size = 10
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
.Ligatures = wdLigaturesNone
.NumberSpacing = wdNumberSpacingDefault
.NumberForm = wdNumberFormDefault
.StylisticSet = wdStylisticSetDefault
.ContextualAlternates = 0
End With
With ActiveDocument.Styles(„Sub 1“)
.AutomaticallyUpdate = False
.BaseStyle = „“
.NextParagraphStyle = „Sub 1“
End With
With ActiveDocument.Styles(„Sub 2“).Font
.Name = „Times New Roman“
.Size = 10
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
.Ligatures = wdLigaturesNone
.NumberSpacing = wdNumberSpacingDefault
.NumberForm = wdNumberFormDefault
.StylisticSet = wdStylisticSetDefault
.ContextualAlternates = 0
End With
With ActiveDocument.Styles(„Sub 2“)
.AutomaticallyUpdate = False
.BaseStyle = „“
.NextParagraphStyle = „Sub 2“
End With
End Sub
–––––––––––––––––

Sub gehezuseite()


‚ Makro zum Springen zu der Seite, deren Nummer mit der im Text markierten Nummer übereinstimmt; Makro wurde aufgezeichnet und dann nachbearbeitet, damit der Code auf beliebige markierte Nummern angewandt werden kann; zur Makroausführung kann sich der Cursor irgendwo im Dokumenttext befinden

a = Selection.Text ‚variable
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=a
End Sub
–––––––––––––––––

Sub pagefeld_einfuegen()


‚ Makro zum Einfügen des Page-Feldes an der Cursor-Position; Makro wurde aufgezeichnet und nicht nachbearbeitet


Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
„PAGE „, PreserveFormatting:=True
End Sub
–––––––––––––––––

Sub page_feld_am_ende_einfügen()


‚ fügt das Page-Feld vor dem letzten Anführungszeichen in das XE-Feld ein; vor dem Page-Feld wird ein Doppelpunkt eingebaut, damit es in der letzten Indexebene steht; Makro wurde aufgezeichnet und nicht nachbearbeitet; zur Makroausführung kann sich der Cursor irgendwo im Dokumenttext befinden

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = „^d XE“
.Replacement.Text = „“
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
.Text = „“““
.Replacement.Text = „“
.Forward = False
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=“:“
Selection.Fields.Add Range:=Selection.Range,
Text:= _
„PAGE „, PreserveFormatting:=True
Selection.MoveRight Unit:=wdCharacter, Count:=3
End Sub
–––––––––––––––––

Sub page_feld_am_anfang_einfügen()


‚Makro zum Einfügen des Page-Feldes direkt nach dem ersten Anführungszeichen im XE-Feld; Makro wurde aufgezeichnet und dann nach-bearbeitet, um es übersichtlicher zu machen. Beim Aufzeichnen des Befehls „Gehe zu XE-Feld“ wird zusätzlicher Code erzeugt, der das Makro nur aufbläht, aber nicht benötigt wird. Der Befehl zum Einbau des Page-Feldes wurde manuell eingefügt; dabei wird einfach ein anderes vorhandenes Makro aufgerufen („Application.Run Macro-Name …“). Zur Makroausführung kann sich der Cursor vor oder direkt im XE-Feld befinden

Selection.GoTo What:=wdGoToField, Which:=wdGoToNext, Count:=1, Name:=“XE“
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = „“““
.Replacement.Text = „“
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Application.Run MacroName:=“pagefeld_einfuegen“
Selection.TypeText Text:=“ „
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub
–––––––––––––––––

Sub seitenende_mark()


‚ Makro Zum Einfügen des Textes <END> am Ende einer Seite. Vor dem Start des Makros muss die Anzeige der nichtdruckbaren Zeichen ausgeschaltet sein; dient als Vorbereitung auf die Seitenvergrößerung (siehe Unterkapitel 4.3), die bei der Anwendung „Index in Word mit Seitenzahlen des Layoutprogramms“ benötigt wird; zur Ausführung des Makros sollte sich der Cursor auf der Seite befinden, auf der die Markierung angebracht werden soll

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=““
‚Jetzt muss die Anzeige der nichtdruckbaren Zeichen einge-schaltet werden, damit der Cursor nach dem Zurückgehen um einen Buchstaben //hinter// evtl. vorhandenem ausgeblendet formatiertem Text steht.
ActiveWindow.ActivePane.View.ShowAll = Not
ActiveWindow.ActivePane.View. _
ShowAll
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=“<END>“
Selection.MoveLeft Unit:=wdCharacter, Count:=5, Ex-tend:=wdExtend
With Selection.Font
.Hidden = True
.Color = wdColorRed
End With
‚Jetzt muss die Anzeige der nichtdruckbaren Zeichen wieder
ausgeschaltet werden, damit der Cursor am Ende der tatsächli-chen Seite steht.
ActiveWindow.ActivePane.View.ShowAll = Not
ActiveWindow.ActivePane.View. _
ShowAll
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub
–––––––––––––––––

Sub seitenende_mark_schleife()

‚ Makro zum Einfügen der <END>-Markierung am Ende aller Seiten des Dokuments; dient zur Vorbereitung der Anwendung „Index in Word mit Seitenzahlen des Layoutprogramms“; vor dem Start des Makros muss die Anzeige der nichtdruckbaren Zeichen ausgeschaltet sein; zur Ausführung des Makros kann sich der Cursor irgendwo im Dokumenttext befinden

Dim a As Integer
Dim i As Integer
Selection.EndKey Unit:=wdStory
Selection.MoveLeft Unit:=wdCharacter, Count:=1
a = Selection.Information(wdActiveEndPageNumber)
‚jetzt ist die Zahl der Seiten bekannt
‚die Schleife soll bis a – 1 laufen, und zwar vom Anfang des
Dokumentes an
Selection.HomeKey Unit:=wdStory
For i = 1 To a – 1
Application.Run MacroName:=“seitenende_mark“
Next i
‚Jetzt wird noch auf der letzten Seite die Seitenmarkierung gesetzt
ActiveWindow.ActivePane.View.ShowAll = Not
ActiveWindow.ActivePane.View. _
ShowAll
Selection.EndKey Unit:=wdStory
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=“<END>“
Selection.MoveLeft Unit:=wdCharacter, Count:=5, Ex-tend:=wdExtend
With Selection.Font
.Hidden = True
.Color = wdColorRed
End With
ActiveWindow.ActivePane.View.ShowAll = Not
ActiveWindow.ActivePane.View. _
ShowAll
Selection.HomeKey Unit:=wdStory
End Sub
–––––––––––––––––

Sub manu_seitenumbr()


‚ Makro zum Einfügen von manuellen Seitenumbrüchen an allen Stellen, an denen vorher die <END>-Markierung eingebaut wurde; Hauptmakro bei der Anwendung „Index in Word mit Seitenzahlen des Layoutprogramms“; zur Ausführung des Makros kann sich der Cursor irgendwo im Dokumenttext befinden

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = „<END>“
.Replacement.Text = „^m“
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
–––––––––––––––––

Sub f_und_ff_reinbringen()

‚Makro zum Ersetzen der Bis-Seitenzahlen durch f und ff im fertigen Index, der zuvor in reinen Text umgewandelt wurde. Gezeigt werden hier nur die ersten Suchen-Ersetzen-Befehle. Sie wurden einzeln aufgezeichnet und dann zusammengebaut (das zweite Makro kopiert und in das erste eingefügt). Alle weiteren Suchen-Ersetzen-Befehle können analog dazu hinzugefügt werden. Das Gesamtmakro würde hier über mehrere Seiten gehen. Zur Ausführung des Makros kann sich der Cursor irgendwo im Index befinden

‚zuerst kommen die dreistelligen Zahlen, bei denen die letzte Ziffer der Von-Seitenzahl eine 8 ist


Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = „([1-9][0-9])(0)–\1(1)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(1)–\1(2)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(2)–\1(3)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(3)–\1(4)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(4)–\1(5)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(5)–\1(6)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(6)–\1(7)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(7)–\1(8)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9][0-9])(8)–\1(9)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt kommen die dreistelligen Zahlen, bei denen die letzte Ziffer der Von-Seitenzahl eine 9 ist und die sich innerjhalb der Hunderterbereiche befinden.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])([0-8])(9)–\1[0-9]0“
.Replacement.Text = „\1\2\3 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt kommen die dreistelligen Zahlen, bei denen die letzte Ziffer der Von-Seitenzahl eine 9 ist und die sich am Übergang der Hunderterbereiche befinden.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(99–)–100“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(199)–200“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(299)–300“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(399)–400“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(499)–500“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(999)–600“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(699)–700“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(799)–800“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(899)–900“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt werden die ff für die dreistelligen Zahlen gesetzt.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([0-9])–[1-9][0-9][0-9]“
.Replacement.Text = „\1 ff“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt werden die f für die zweistelligen Zahlen gesetzt.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(0)–\1(1)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(1)–\1(2)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(2)–\1(3)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(3)–\1(4)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(4)–\1(5)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(5)–\1(6)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(6)–\1(7)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(7)–\1(8)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])(8)–\1(9)“
.Replacement.Text = „\1\2 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(9)–10“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt werden die ff für die zweistelligen Zahlen gesetzt.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([0-9])–[1-9][0-9]“
.Replacement.Text = „\1 ff“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt werden die f für die einstelligen Zahlen gesetzt.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(1)–2“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(2)–3“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(3)–4“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(4)–5“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(5)–6“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(6)–7“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(7)–8“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „(8)–9“
.Replacement.Text = „\1 f“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

‚ jetzt werden die ff für die einstelligen Zahlen gesetzt.

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = „([1-9])-[1-9]“
.Replacement.Text = „\1 ff“
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

End Sub
–––––––––––––––––