' Laatste update: 19 juni 2003 Sub MaakAlleTabellen() Dim start As Variant Dim einde As Variant ' ga naar begin pagina Selection.HomeKey Unit:=wdStory ' zoek eerste TAB Selection.Find.ClearFormatting With Selection.Find .Text = "^t" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute ' verwijder alles erboven Selection.HomeKey Unit:=wdStory, Extend:=wdExtend Selection.Delete Unit:=wdCharacter, Count:=1 ' zet kantlijnen kleiner etc. Call SetPage ' verander alles mooi in tabellen Call MaakTabellen ' zet Tab posities voor afdrukken indelingen Call SetTabs ' ga naar begin pagina Selection.HomeKey Unit:=wdStory ' bewaar onder nieuwe naam (.doc ipv .txt) ActiveDocument.SaveAs FileName:=Left(ActiveDocument.FullName, Len(ActiveDocument.FullName) - 3) + "doc", FileFormat:= _ wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _ True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _ False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False End Sub Sub MaakTabellen() ' Ga naar einde document Selection.EndKey Unit:=wdStory ' Zoek begin van vierkamp met 5/6 spelers Selection.Find.ClearFormatting With Selection.Find .Text = "6^tTot" .Forward = False .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Do While Selection.Find.Found ' Ga naar begin regel Selection.HomeKey Unit:=wdLine ' formatteer de tabel Call MakeTable6 ' Zoek begin van vierkamp met 5/6 spelers Selection.Find.ClearFormatting With Selection.Find .Text = "6^tTot" .Forward = False .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Loop ' Ga naar einde document Selection.EndKey Unit:=wdStory ' Zoek begin van vierkamp met 3/4 spelers Selection.Find.ClearFormatting With Selection.Find .Text = "4^tTot" .Forward = False .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Do While Selection.Find.Found ' Ga naar begin regel Selection.HomeKey Unit:=wdLine ' formatteer de tabel Call MakeTable4 ' Zoek begin van vierkamp met 3/4 spelers Selection.Find.ClearFormatting With Selection.Find .Text = "4^tTot" .Forward = False .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Loop End Sub Sub MakeTable4() ' set font van tabel op Arial 12 Selection.MoveDown Unit:=wdLine, Count:=5, Extend:=wdExtend Selection.Font.Name = "Arial" Selection.Font.Size = 12 ' maak er een tabel van Selection.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=7, _ NumRows:=5, Format:=wdTableFormatNone, ApplyBorders:=True, ApplyShading:= _ True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows:=True, _ ApplyLastRow:=False, ApplyFirstColumn:=True, ApplyLastColumn:=False, _ AutoFit:=True ' zet het op type Grid5 Selection.Tables(1).AutoFormat Format:=wdTableFormatGrid5, ApplyBorders:= _ True, ApplyShading:=True, ApplyFont:=True, ApplyColor:=True, _ ApplyHeadingRows:=True, ApplyLastRow:=False, ApplyFirstColumn:=True, _ ApplyLastColumn:=True, AutoFit:=True Selection.Rows.HeightRule = wdRowHeightAtLeast Selection.Rows.Height = InchesToPoints(0.32) Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter ' centreer de hokjes Selection.EndKey Unit:=wdLine Selection.MoveDown Unit:=wdLine, Count:=4, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=4, Extend:=wdExtend Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter ' set font van indeling op Arial 10 Selection.MoveDown Unit:=wdLine, Count:=1 Selection.HomeKey Unit:=wdLine Selection.MoveDown Unit:=wdLine, Count:=3, Extend:=wdExtend Selection.Font.Name = "Arial" Selection.Font.Size = 10 ' protect tabel from page break Selection.MoveUp Unit:=wdLine, Count:=5 Selection.MoveDown Unit:=wdLine, Count:=8, Extend:=wdExtend With Selection.ParagraphFormat .KeepWithNext = True End With ' ga naar volgende regel Selection.MoveDown Unit:=wdLine, Count:=1 End Sub Sub MakeTable6() ' set font van tabel op Arial 12 Selection.MoveDown Unit:=wdLine, Count:=7, Extend:=wdExtend Selection.Font.Name = "Arial" Selection.Font.Size = 12 ' maak er een tabel van Selection.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=9, _ NumRows:=7, Format:=wdTableFormatNone, ApplyBorders:=True, ApplyShading:= _ True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows:=True, _ ApplyLastRow:=False, ApplyFirstColumn:=True, ApplyLastColumn:=False, _ AutoFit:=True ' zet het op type Grid5 Selection.Tables(1).AutoFormat Format:=wdTableFormatGrid5, ApplyBorders:= _ True, ApplyShading:=True, ApplyFont:=True, ApplyColor:=True, _ ApplyHeadingRows:=True, ApplyLastRow:=False, ApplyFirstColumn:=True, _ ApplyLastColumn:=True, AutoFit:=True Selection.Rows.HeightRule = wdRowHeightAtLeast Selection.Rows.Height = InchesToPoints(0.32) Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter ' centreer de hokjes Selection.EndKey Unit:=wdLine Selection.MoveDown Unit:=wdLine, Count:=6, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=6, Extend:=wdExtend Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter ' set font van indeling op Arial 10 Selection.MoveDown Unit:=wdLine, Count:=1 Selection.HomeKey Unit:=wdLine Selection.MoveDown Unit:=wdLine, Count:=3, Extend:=wdExtend Selection.Font.Name = "Arial" Selection.Font.Size = 10 ' protect tabel from page break Selection.MoveUp Unit:=wdLine, Count:=7 Selection.MoveDown Unit:=wdLine, Count:=10, Extend:=wdExtend With Selection.ParagraphFormat .KeepWithNext = True End With ' ga naar volgende regel Selection.MoveDown Unit:=wdLine, Count:=1 End Sub Sub SetPage() ' zet klein font, zodat regels niet over meer regels wordt verdeeld, ' want dan werkt de macro niet meer Selection.HomeKey Unit:=wdStory Selection.EndKey Unit:=wdStory, Extend:=wdExtend Selection.Font.Name = "Arial" Selection.Font.Size = 8 ' zet margins etc. With ActiveDocument.PageSetup .TopMargin = InchesToPoints(0.63) .BottomMargin = InchesToPoints(0.63) .LeftMargin = InchesToPoints(0.92) .RightMargin = InchesToPoints(0.92) .Gutter = InchesToPoints(0) .HeaderDistance = InchesToPoints(0) .FooterDistance = InchesToPoints(0) End With End Sub Sub SetTabs() ' ga naar begin pagina Selection.HomeKey Unit:=wdStory ' selecteer hele document Selection.EndKey Unit:=wdStory, Extend:=wdExtend ' verwijder alle TABs Selection.ParagraphFormat.TabStops.ClearAll ' zet twee nieuwe TABs ActiveDocument.DefaultTabStop = CentimetersToPoints(1.25) Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(6.5), _ Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(11.5), _ Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces End Sub Sub RemoveManualPageBreaks() ' verwijder eerst de Page Breaks Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^m" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' verwijder daarna overtollige paragraphs ' (veroorzaakt door invoegen van page breaks) Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^p^p^p" .Replacement.Text = "^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub