AnsweredAssumed Answered

How do I add a blank row to a revision table with a macro WITHOUT incrementing the rev?

Question asked by Jim Warren on Sep 24, 2020
Latest reply on Sep 28, 2020 by Jim Warren

Hello SW friends! I need a macro that adds a simple row to the top of my (bottom-up) rev table, but doesn't increment the revision. Here is the code I borrowed and modified:


Dim swApp As Object

Sub main()

Set swApp = Application.SldWorks
Dim swDraw As SldWorks.DrawingDoc
Dim swSheet As SldWorks.Sheet

Set swDraw = swApp.ActiveDoc

If Not swDraw Is Nothing Then

Set swSheet = swDraw.GetCurrentSheet

Dim swRevTable As SldWorks.RevisionTableAnnotation

Set swRevTable = swSheet.RevisionTable

If Not swRevTable Is Nothing Then

AddRevision swRevTable, " ", Array("", "", "RELEASED TO PRODUCTION")

MsgBox "There is no revision table in the drawing"
End If

MsgBox "Please open a drawing"
End If

End Sub

Sub AddRevision(swRevTable As SldWorks.RevisionTableAnnotation, revName As String, rowData As Variant)

Dim i As Integer
Dim swTableAnn As SldWorks.TableAnnotation

Set swTableAnn = swRevTable

swRevTable.AddRevision revName

For i = 0 To UBound(rowData)

If rowData(i) <> "" Then

swTableAnn.Text(swTableAnn.RowCount - (swTableAnn.RowCount), i) = rowData(i)

End If


End Sub


This code gives me the row, which includes today's date, and the "RELEASED TO PRODUCTION" description. Unfortunately, it also increments the revision, so that the next revision skips a letter (since this rev is blank).


Is there a way to do this?

without the next revision being Rev E?

If I manually add a row (LMB top row - insert: row above), then type in the info, the rev stays correct, like this:


Any help would be appreciated. I am hoping to use this code to automate production release of multiple drawings.


Thanks a ton,