<?php
/*
author: Timotheus Pokorra (timotheus@pokorra.de)
file: printword.txt
autumn 2002
feel free to use and modify
no guarantuee
*/
?>

tabellen, change: einfacher Zeilenabstand, linksbündig, innerhalb der Seite




try to download latest html components for word
try to build figures directory from alt tag of img

save http://localhost/diploma-dissertation/diplomathesis.php?printword=1 as diplomathesis.htm
in Word: Alt-F8, execute macro diplomathesis

Graphics: embed in text, give Description
Tables: alignment left (2nd column), no 1.5 space between lines; colwidth; grid by word, not html; only inside grid

Index

Frontpage

Line Numbers: 2 parts of document 





open diplomathesis.htm with MS Word

File / save as word document (not save as)

configure first page

Insert/Index and directories/: "Formell", 5 layers

replace "*** pagebr ***" with ^m
replace "*** parabr *** " with ^a

Grafiken sind noch nicht in ordnung: sollten mit Text verbunden sein

Seitenzahlen: 
1 Introduction hochziehen auf vorherige Seite, dann einfügen manueller Wechsel
abschnittswechsel nächste Seite.
dann bei inhaltsverzeichnis einfügen Seitenzahlen, erste Seite nicht anzeigen,
I,II,III
bei introduction einfügen Seitenzahlen, erste seite anzeigen, 1,2,3

ganz am Schluss Seitenzahlen im inhaltsverzeichnis aktualisieren

alle Bilder müssen mal im Word angezeigt worden sein, dann werden sie richtig gedruckt auf pdf

Index: alle Stichwörter aus der Datei kopieren, in extra Datei speichern. 
Einfügen Index Autofestlegen, und Autofestlegungsdatei auswählen
dann nochmal einfügen index ok
achtung. es wird automatisch ein neuer abschnitt erzeugt.
auf letzte Seite gehen, und seitenzahlen einfügen, Zahlen fortsetzen von letztem Abschnitt

siehe Festlegen von Wörtern oder Satzteilen für Indexeinträge
oder Erstellen einer Konkordanzdatei
Ränder:
Oben:	3 cm
Unten:	2.5 cm
Links:	3 cm
Rechts:	2.5 cm
bundsteg=0 cm
Kopfzeile:	1.5 cm
fußzeile:0
Für den Text wird die Schriftart Arial 12 verwendet. Der Text wird im Blocksatz ausgerichtet. 
Zeilenabstände:
im Text:	1,5 Zeilen (18 pt)
zwischen Absätzen:	6 pt
vor Kapitelüberschriften:	24 pt	vor Unterkapitelüberschriften:	12 pt
nach Kapitelüberschriften:	12 pt	nach Unterkapitelüberschriften:	6 pt
Kopfzeile:	1,5 cm

Formatvorlage bearbeiten, Standard



Sub diplomathesis()
'
' diplomathesis Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="Diploma thesis.htm", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    Application.Run MacroName:="HTMLFileSaveAsDoc"
    ActiveDocument.Close
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="Diploma thesis.doc", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then
        ActiveWindow.ActivePane.View.Type = wdPageView
    Else
        ActiveWindow.View.Type = wdPageView
    End If
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(3)
        .BottomMargin = CentimetersToPoints(2.5)
        .LeftMargin = CentimetersToPoints(3)
        .RightMargin = CentimetersToPoints(2.5)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.5)
        .FooterDistance = CentimetersToPoints(0)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = True
        .MirrorMargins = False
    End With
   
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "*** parabr *** "
        .Replacement.Text = "^a"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "*** pagebr ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** Table of Contents ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=3
    With ActiveDocument
        .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
            True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _
            LowerHeadingLevel:=3, IncludePageNumbers:=True, AddedStyles:=""
        .TablesOfContents(1).TabLeader = wdTabLeaderDots
    End With

    
    
    With ActiveDocument.Styles("Standard")
        .AutomaticallyUpdate = False
        .BaseStyle = ""
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("Standard").Font
        .Name = "Arial"
        .Size = 12
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("Standard").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphJustify
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("Vorformatiert")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Vorformatiert"
    End With
    With ActiveDocument.Styles("Vorformatiert").Font
        .Name = "Courier"
        .Size = 10
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("Vorformatiert").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 0
        .SpaceAfter = 12
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphLeft
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("H1")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H1").Font
        .Name = "Arial"
        .Size = 14
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = True
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 14
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H1").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 24
        .SpaceAfter = 12
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H2")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H2").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H2").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H3")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H3").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H3").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H4")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H4").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H4").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With

    Selection.Style = ActiveDocument.Styles("Standard")

End Sub



Sub diplomathesis()
'
' diplomathesis Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="konkordanz.htm", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    Application.Run MacroName:="HTMLFileSaveAsDoc"
    ActiveDocument.Close
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="Diploma thesis.htm", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    Application.Run MacroName:="HTMLFileSaveAsDoc"
    ActiveDocument.Close
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="Diploma thesis.doc", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then
        ActiveWindow.ActivePane.View.Type = wdPageView
    Else
        ActiveWindow.View.Type = wdPageView
    End If
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(3)
        .BottomMargin = CentimetersToPoints(2.5)
        .LeftMargin = CentimetersToPoints(3)
        .RightMargin = CentimetersToPoints(2.5)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.5)
        .FooterDistance = CentimetersToPoints(0)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = True
        .MirrorMargins = False
    End With
   
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "*** parabr *** "
        .Replacement.Text = "^a"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "*** pagebr ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
    ' table of contents
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** Table of Contents ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=2
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.TypeParagraph
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.Font.Size = 14
    Selection.Font.Bold = wdToggle
    Selection.TypeText Text:="Table of Contents"
    
    With ActiveDocument
        .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
            True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _
            LowerHeadingLevel:=4, IncludePageNumbers:=True, AddedStyles:=""
        .TablesOfContents(1).TabLeader = wdTabLeaderDots
    End With

    
    
    With ActiveDocument.Styles("Standard")
        .AutomaticallyUpdate = False
        .BaseStyle = ""
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("Standard").Font
        .Name = "Arial"
        .Size = 12
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("Standard").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphJustify
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("Vorformatiert")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Vorformatiert"
    End With
    With ActiveDocument.Styles("Vorformatiert").Font
        .Name = "Courier"
        .Size = 10
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("Vorformatiert").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 0
        .SpaceAfter = 12
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphLeft
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("H1")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H1").Font
        .Name = "Arial"
        .Size = 14
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = True
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 14
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H1").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 24
        .SpaceAfter = 12
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H2")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H2").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H2").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H3")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H3").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H3").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H4")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H4").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H4").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With

    Selection.Style = ActiveDocument.Styles("Standard")
    
    'align first page
    Selection.HomeKey Unit:=wdStory
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    
'
' pagenum Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** start_page_num ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.MoveDown Unit:=wdLine, Count:=2
    Selection.TypeBackspace
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    With Selection.Sections(1).Headers(1).PageNumbers
        .NumberStyle = wdPageNumberStyleArabic
        .HeadingLevelForChapter = 0
        .IncludeChapterNumber = False
        .ChapterPageSeparator = wdSeparatorHyphen
        .RestartNumberingAtSection = True
        .StartingNumber = 1
    End With
    Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
        wdAlignPageNumberRight, FirstPage:=True
    Selection.HomeKey Unit:=wdStory
    With Selection.Sections(1).Headers(1).PageNumbers
        .NumberStyle = wdPageNumberStyleUppercaseRoman
        .HeadingLevelForChapter = 0
        .IncludeChapterNumber = False
        .ChapterPageSeparator = wdSeparatorHyphen
        .RestartNumberingAtSection = False
        .StartingNumber = 0
    End With
    Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
        wdAlignPageNumberRight, FirstPage:=False

'
' index Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** index ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    startindexpage = Selection.Start
    
    Selection.Delete Unit:=wdCharacter, Count:=1
    With ActiveDocument
        .Indexes.AutoMarkEntries ConcordanceFileName:="C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien\konkordanz.doc"
        .Indexes.Add Range:=Selection.Range, HeadingSeparator:= _
            wdHeadingSeparatorLetter, Type:=wdIndexIndent, RightAlignPageNumbers _
            :=False, NumberOfColumns:=2, AccentedLetters:=False
        .Indexes(1).TabLeader = wdTabLeaderSpaces
    End With
    
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "REFERENCES"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    While Selection.Start > startindexpage
        With Selection.Sections(1).Headers(1).PageNumbers
            .NumberStyle = wdPageNumberStyleArabic
            .HeadingLevelForChapter = 0
            .IncludeChapterNumber = False
            .ChapterPageSeparator = wdSeparatorHyphen
            .RestartNumberingAtSection = False
            .StartingNumber = 0
        End With
        Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
            wdAlignPageNumberRight, FirstPage:=True
        Selection.MoveUp Unit:=wdScreen, Count:=1
    Wend
    
    With ActiveDocument.Styles("Indexüberschrift")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Index 1"
    End With
    With ActiveDocument.Styles("Indexüberschrift").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphCenter
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    Selection.Style = ActiveDocument.Styles("Indexüberschrift")
    With ActiveDocument.Styles("Index 1").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphLeft
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    
    
    ' refresh table of contents pages
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "Table of Contents"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.MoveDown Unit:=wdScreen, Count:=1
    Selection.Fields.Update

End Sub


Sub diplomathesis()
'
' diplomathesis Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="konkordanz.htm", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    Application.Run MacroName:="HTMLFileSaveAsDoc"
    ActiveDocument.Close
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="Diploma thesis.htm", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    Application.Run MacroName:="HTMLFileSaveAsDoc"
    ActiveDocument.Close
    ChangeFileOpenDirectory "C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien"
    Documents.Open FileName:="Diploma thesis.doc", ConfirmConversions:= _
        False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then
        ActiveWindow.ActivePane.View.Type = wdPageView
    Else
        ActiveWindow.View.Type = wdPageView
    End If
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(3)
        .BottomMargin = CentimetersToPoints(2.5)
        .LeftMargin = CentimetersToPoints(3)
        .RightMargin = CentimetersToPoints(2.5)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.5)
        .FooterDistance = CentimetersToPoints(0)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = True
        .MirrorMargins = False
    End With
   
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "*** parabr *** "
        .Replacement.Text = "^a"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "*** pagebr ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
    ' table of contents
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** Table of Contents ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=2
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.TypeParagraph
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.Font.Size = 14
    Selection.Font.Bold = wdToggle
    Selection.TypeText Text:="Table of Contents"
    
    With ActiveDocument
        .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
            True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _
            LowerHeadingLevel:=4, IncludePageNumbers:=True, AddedStyles:=""
        .TablesOfContents(1).TabLeader = wdTabLeaderDots
    End With

    
    
    With ActiveDocument.Styles("Standard")
        .AutomaticallyUpdate = False
        .BaseStyle = ""
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("Standard").Font
        .Name = "Arial"
        .Size = 12
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("Standard").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphJustify
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("Vorformatiert")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Vorformatiert"
    End With
    With ActiveDocument.Styles("Vorformatiert").Font
        .Name = "Courier"
        .Size = 10
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("Vorformatiert").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 0
        .SpaceAfter = 12
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphLeft
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("H1")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H1").Font
        .Name = "Arial"
        .Size = 14
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = True
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 14
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H1").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 24
        .SpaceAfter = 12
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H2")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H2").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H2").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H3")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H3").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H3").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With
    With ActiveDocument.Styles("H4")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Standard"
    End With
    With ActiveDocument.Styles("H4").Font
        .Name = "Arial"
        .Size = 12
        .Bold = True
        .Italic = False
        .Underline = wdUnderlineNone
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .ColorIndex = wdAuto
        .Engrave = False
        .Superscript = False
        .Subscript = False
        .Scaling = 100
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    With ActiveDocument.Styles("H4").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 12
        .SpaceAfter = 6
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = True
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevel1
    End With

    Selection.Style = ActiveDocument.Styles("Standard")
    
    'align first page
    Selection.HomeKey Unit:=wdStory
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    
'
' pagenum Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** start_page_num ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.MoveDown Unit:=wdLine, Count:=2
    Selection.TypeBackspace
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    With Selection.Sections(1).Headers(1).PageNumbers
        .NumberStyle = wdPageNumberStyleArabic
        .HeadingLevelForChapter = 0
        .IncludeChapterNumber = False
        .ChapterPageSeparator = wdSeparatorHyphen
        .RestartNumberingAtSection = True
        .StartingNumber = 1
    End With
    Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
        wdAlignPageNumberRight, FirstPage:=True
    Selection.HomeKey Unit:=wdStory
    With Selection.Sections(1).Headers(1).PageNumbers
        .NumberStyle = wdPageNumberStyleUppercaseRoman
        .HeadingLevelForChapter = 0
        .IncludeChapterNumber = False
        .ChapterPageSeparator = wdSeparatorHyphen
        .RestartNumberingAtSection = False
        .StartingNumber = 0
    End With
    Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
        wdAlignPageNumberRight, FirstPage:=False


End Sub
Sub format_tabelle()
'
' format_tabelle Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    With Selection.Borders(wdBorderHorizontal)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .ColorIndex = Options.DefaultBorderColorIndex
    End With
    With Selection.Borders(wdBorderVertical)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .ColorIndex = Options.DefaultBorderColorIndex
    End With
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle
End Sub
Sub format_change()
'
' format_change Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle
End Sub

Sub create_index()
'
' index Makro
' Makro aufgezeichnet am / von Timotheus Pokorra
'
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** index ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    startindexpage = Selection.Start
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    
    With ActiveDocument
        .Indexes.AutoMarkEntries ConcordanceFileName:="C:\Dokumente und Einstellungen\Timotheus\Eigene Dateien\konkordanz.doc"
        .Indexes.Add Range:=Selection.Range, HeadingSeparator:= _
            wdHeadingSeparatorLetter, Type:=wdIndexIndent, RightAlignPageNumbers _
            :=False, NumberOfColumns:=2, AccentedLetters:=False
        .Indexes(1).TabLeader = wdTabLeaderSpaces
    End With
    
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "REFERENCES"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
        With Selection.Sections(1).Headers(1).PageNumbers
            .NumberStyle = wdPageNumberStyleArabic
            .HeadingLevelForChapter = 0
            .IncludeChapterNumber = False
            .ChapterPageSeparator = wdSeparatorHyphen
            .RestartNumberingAtSection = False
            .StartingNumber = 0
        End With
        Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
            wdAlignPageNumberRight, FirstPage:=True
    
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*** index ***"
        .Replacement.Text = "^m"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=30
        With Selection.Sections(1).Headers(1).PageNumbers
            .NumberStyle = wdPageNumberStyleArabic
            .HeadingLevelForChapter = 0
            .IncludeChapterNumber = False
            .ChapterPageSeparator = wdSeparatorHyphen
            .RestartNumberingAtSection = False
            .StartingNumber = 0
        End With
        Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
            wdAlignPageNumberRight, FirstPage:=True
    
    While False And Selection.Start > startindexpage
        With Selection.Sections(1).Headers(1).PageNumbers
            .NumberStyle = wdPageNumberStyleArabic
            .HeadingLevelForChapter = 0
            .IncludeChapterNumber = False
            .ChapterPageSeparator = wdSeparatorHyphen
            .RestartNumberingAtSection = False
            .StartingNumber = 0
        End With
        Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
            wdAlignPageNumberRight, FirstPage:=True
        Selection.MoveUp Unit:=wdScreen, Count:=1
    Wend
    
    With ActiveDocument.Styles("Indexüberschrift")
        .AutomaticallyUpdate = False
        .BaseStyle = "Standard"
        .NextParagraphStyle = "Index 1"
    End With
    With ActiveDocument.Styles("Indexüberschrift").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphCenter
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    With ActiveDocument.Styles("Index 1").ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 5
        .SpaceAfter = 5
        .LineSpacingRule = wdLineSpace1pt5
        .Alignment = wdAlignParagraphLeft
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    
    
    ' refresh table of contents pages
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "Table of Contents"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.MoveDown Unit:=wdScreen, Count:=1
    Selection.Fields.Update

End Sub
