Public
Sub
Tabelle2er2Rows()
Call
doTabelle(2, 2)
End
Sub
Public
Sub
Tabelle2er()
Call
doTabelle(1, 2)
End
Sub
Public
Sub
Tabelle1er2Rows()
Call
doTabelle(2, 1)
End
Sub
Public
Sub
Tabelle1er()
Call
doTabelle(1, 1)
End
Sub
Private
Sub
doTabelle(NumRows
As
Integer
, NumCols
As
Integer
)
If
NumCols < 2
Then
NumCols = 1
Else
NumCols = NumCols + (NumCols - 1)
End
If
Dim
objTab
As
Table
Set
objTab = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=1, NumColumns:= _
NumCols, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed)
With
objTab
If
.Style <>
"Tabellenraster"
Then
.Style =
"Tabellenraster"
End
If
.ApplyStyleHeadingRows =
True
.ApplyStyleLastRow =
False
.ApplyStyleFirstColumn =
True
.ApplyStyleLastColumn =
False
.ApplyStyleRowBands =
True
.ApplyStyleColumnBands =
False
.TopPadding = CentimetersToPoints(0)
.BottomPadding = CentimetersToPoints(0)
.LeftPadding = CentimetersToPoints(0.19)
.RightPadding = CentimetersToPoints(0.19)
.Spacing = 0
.AllowPageBreaks =
True
.AllowAutoFit =
False
With
.Range
Dim
iCol
As
Integer
For
iCol = 1
To
.Rows(1).Cells.Count
With
.Cells(iCol)
.WordWrap =
False
.FitText =
False
.PreferredWidthType = wdPreferredWidthPoints
.PreferredWidth = CentimetersToPoints(7.3)
.VerticalAlignment = wdCellAlignVerticalCenter
If
iCol / 2 = Int(iCol / 2)
Then
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.PreferredWidth = CentimetersToPoints(1)
Else
With
.Range.ParagraphFormat
.Alignment = wdAlignParagraphCenter
.LeftIndent = CentimetersToPoints(0)
.RightIndent = CentimetersToPoints(0)
.SpaceBefore = 0
.SpaceBeforeAuto =
False
.SpaceAfter = 0
.SpaceAfterAuto =
False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphLeft
.WidowControl =
True
.KeepWithNext =
False
.KeepTogether =
False
.PageBreakBefore =
False
.NoLineNumber =
False
.Hyphenation =
True
.FirstLineIndent = CentimetersToPoints(0)
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End
With
End
If
End
With
Next
With
.Rows
.Alignment = wdAlignRowCenter
.HeightRule = wdRowHeightAtLeast
.Height = CentimetersToPoints(5.4)
.AllowBreakAcrossPages =
False
End
With
End
With
.TopPadding = CentimetersToPoints(0)
.BottomPadding = CentimetersToPoints(0)
.LeftPadding = CentimetersToPoints(0.19)
.RightPadding = CentimetersToPoints(0.19)
.Spacing = 0
.AllowPageBreaks =
True
.AllowAutoFit =
False
End
With
If
NumRows = 2
Then
Dim
objRw
As
Row
Set
objRw = objTab.Rows.Add
With
objRw
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
With
.Range
.Style =
"Bildbeschriftung"
.Font.Size = 9
.Font.Name =
"Myriad Pro"
.Font.Italic =
True
.ParagraphFormat.Alignment = wdAlignParagraphCenter
End
With
End
With
End
If
objTab.Range.
Select
End
Sub