AnsweredAssumed Answered

Revision Block Macro, Runtime Error 91

Question asked by Rand Vaz on May 30, 2019
Latest reply on Jun 3, 2019 by Jim Sculley

Hello,  another noob here looking for help with a simple revision table macro.

I can get the table to show on the drawing sheet, but cannot get the table to fill in the desired text.

The codes fails and shows a runtime error # 91.

"myTable.Text(2, 1) = "-" " shows up as a highlighted line. Shown below with exclamation emoticons

Please help. Thank you

 

The code is;

 

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Dim currentSheet As Object
Dim myRevisionTable As Object
Set currentSheet = Part.GetCurrentSheet()
Set myRevisionTable = currentSheet.InsertRevisionTable(False, 1.10057961122901, 0.848675142495361, 2, "")
boolstatus = Part.Extension.SelectByID2("DetailItem1925@Sheet1", "REVISIONTABLE", 0.936118581227239, 0.825723166872313, 0, False, 0, Nothing, 0)
Set currentSheet = Part.GetCurrentSheet()
Set myRevisionTable = currentSheet.RevisionTable
longstatus = myRevisionTable.AddRevision("")
boolstatus = Part.Extension.SelectByID2("DetailItem1925@Sheet1", "REVISIONTABLE", 0.956049382843673, 0.822484411609642, 0, False, 0, Nothing, 0)

Dim myTable As Object
Set myTable = Part.SelectionManager.GetSelectedObject5(1)
myTable.Text(2, 1) = "-" 
boolstatus = Part.Extension.SelectByID2("DetailItem1925@Sheet1", "REVISIONTABLE", 0.986942125349144, 0.821737006549026, 0, False, 0, Nothing, 0)

Set myTable = Part.SelectionManager.GetSelectedObject5(1)
myTable.Text(2, 2) = "INITIAL REALEASE"
boolstatus = Part.Extension.SelectByID2("DetailItem1925@Sheet1", "REVISIONTABLE", 1.07837467776453, 0.850387533872649, 0, False, 0, Nothing, 0)

End Sub

Outcomes