Hallo,
ich habe ein Makro, dass mir im Word 2003 einen Text bearbeitet. Leider fehlt mir noch ein Arbeitsschritt, den ich bisher immer umständlich per Hand eingearbeitet habe:
Das Dokument besteht aus Text und Zahlen die -um Spalten zu erzeugen durch Tabstopps- getrennt sind. Vor dem dem 23-ten Tabstopp müsste in jeder Zeile (die Zeilenanzahl variert) ein : eingefügt werden.
Gibt es eine Möglichkeit diesen Arbeitsschritt in das Makro zu integrieren?? Das Makro schaut bis jetzt so aus (hab ich von meinem Vorgänger übernommen, wer das ursprünglich geschrieben hat, weiß ich leider nicht):
Sub GrosseTabelleAnpassen()
’ Zeilen Löschen
Selection.HomeKey wdLine
Selection.MoveDown wdLine, 2, wdExtend
Selection.Delete wdCharacter, 1
’ Selection.MoveDown wdScreen, 1
Selection.EndKey Unit:=wdStory
Selection.EndKey Unit:=wdLine
Selection.HomeKey wdLine, wdExtend
Selection.Delete wdCharacter, 1
Selection.TypeBackspace
’ Tabelle selektieren
Selection.WholeStory
’ Zeichensatz
With Selection.Font
.Name = „Arial“
.Size = 7
.Bold = True
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorBlack
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
’ Zeilenabstand, …
With Selection.ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.RightIndent = CentimetersToPoints(0)
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 7.75
.Alignment = wdAlignParagraphLeft
.WidowControl = False
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = CentimetersToPoints(0)
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitAfter = 0
End With
’ Tabulatoren löschen
Selection.ParagraphFormat.TabStops.ClearAll
’ Neue Tabulatoren setzen
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(0.5), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(0.7), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(3.5), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(4), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(4.5), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(5), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(5.6), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(5.65), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(6.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
’
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(6.75), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(7.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(7.75), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(8.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(8.75), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(9.6), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(9.65), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(10.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(11.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(11.75), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(12.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(12.75), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
’
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(13.6), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces '!!!
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(13.65), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(14.25), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
’ Tabelle selektieren
Selection.WholeStory
Selection.Copy
End Sub
Da ich leider von VBA fast gar keine Ahnung habe, schon mal Danke für jegliche Hilfe.
Grüße
Yogi