Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Ralf_Krieg
in reply to: f_calebh

Hello

 

The loop "For oCell = 1 To oCellCount - 1" is not necessary. I've modified your code a little bit and it seems to work now.

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
    MsgBox("A Drawing Document must be active for this rule (" & iLogicVb.RuleName & ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
    Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oRevTbl As RevisionTable = oSheet.RevisionTables.Item(1)
Dim oTitle As String = oRevTbl.Title
Dim oPos As Point2d = oRevTbl.Position
Dim oRowCount As Integer = oRevTbl.RevisionTableRows.Count
Dim oColCount As Integer = oRevTbl.RevisionTableColumns.Count
Dim oCellCount As Integer = oRowCount * oColCount
Dim oColTitles(oColCount - 1) As String
Dim oColWidths(oColCount - 1) As Double
Dim oRowHeights(oRowCount - 1) As Double
Dim oCellContents(oCellCount-1) As String
Dim oRow, oCol, oCell As Integer

For oRow = 1 To oRowCount
	For oCol = 1 To oColCount
		oCellContents(oCell) = oRevTbl.RevisionTableRows.Item(oRow).Item(oCol).FormattedText
		oCell = oCell+1
		oColTitles(oCol - 1) = oRevTbl.RevisionTableColumns.Item(oCol).Title
		oColWidths(oCol - 1) = oRevTbl.RevisionTableColumns.Item(oCol).Width
	Next
	oRowHeights(oRow - 1) = oRevTbl.RevisionTableRows.Item(oRow).Height
Next

Dim oCTable As CustomTable = oSheet.CustomTables.Add(oTitle, oPos, oColCount, oRowCount, oColTitles, oCellContents, oColWidths, oRowHeights)

 


R. Krieg
RKW Solutions
www.rkw-solutions.com