Code:
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As LongSub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myTable As Object
Dim Zelle As Object
Set myTable = Part.InsertTableAnnotation(0.02, 0.02, 3, 3, 3)
If Not myTable Is Nothing Then
myTable.BorderLineWeight = 0
myTable.GridLineWeight = 0
End If
' Stelle Zeichengröße für die ganze Tabelle ein
Dim swTextFormat As SldWorks.TextFormat
Set swTextFormat = myTable.GetTextFormat
swTextFormat.CharHeightInPts = 9
boolstatus = myTable.SetTextFormat(False, swTextFormat)
' Überschrift fett
Dim swCellFormat As SldWorks.TextFormat
Set swCellFormat = myTable.GetCellTextFormat(0, 0)
swCellFormat.Bold = True
boolstatus = myTable.SetCellTextFormat(0, 0, False, swCellFormat)
' Linksbündig einiger Zellen
myTable.CellTextHorizontalJustification(0, 0) = 1
myTable.CellTextHorizontalJustification(1, 0) = 1
' Spaltenbreite
boolstatus = myTable.SetColumnWidth(0, 0.03, 0)
boolstatus = myTable.SetColumnWidth(1, 0.015, 0)
boolstatus = myTable.SetColumnWidth(2, 0.015, 0)
boolstatus = myTable.MergeCells(0, 0, 0, 2)
myTable.Text(0, 0) = "Teilenummer"
myTable.Text(1, 0) = "Variable_Index" 'Der Index soll in der fertigen Tabelle tiefgestellt sein (Zur Not würde es auch eine kleinere Schriftgröße tun)
End Sub