Get Revision Table Example (VBA)
This example shows how to get information from a revision table annotation.
'--------------------------------------
'
' Preconditions:
' (1)
Drawing is open.
' (2)
Current drawing sheet contains a revision table annotation.
'
' Postconditions: None
'
'--------------------------------------
Option Explicit
Sub ProcessTableAnn _
( _
swApp
As SldWorks.SldWorks, _
swModel
As SldWorks.ModelDoc2, _
swTable
As SldWorks.TableAnnotation _
)
Dim
sRowStr As
String
Dim
i As
Long
Dim
j As
Long
For
i = 0 To swTable.ColumnCount +
1
sRowStr
= " "
For
j = 0 To swTable.RowCount + 1
sRowStr
= sRowStr & "|" & swTable.text(i, j)
Next
j
Debug.Print
" "
& sRowStr
Next
i
End Sub
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swDraw As
SldWorks.DrawingDoc
Dim
swSheet As
SldWorks.Sheet
Dim
swRevTable As
SldWorks.RevisionTableAnnotation
Dim
swTable As
SldWorks.TableAnnotation
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swDraw = swModel
Set
swSheet = swDraw.GetCurrentSheet:
Debug.Assert Not swSheet Is Nothing
Set
swRevTable = swSheet.RevisionTable:
Debug.Assert Not swRevTable Is Nothing
Set
swTable = swRevTable: Debug.Assert Not swTable Is Nothing
Debug.Print
"File = " & swModel.GetPathName
ProcessTableAnn
swApp, swModel, swTable
End Sub
'--------------------------------------