Bri Guy

Stuck on userform

Discussion created by Bri Guy on Feb 5, 2020
Latest reply on Feb 6, 2020 by Deepak Gupta

Hello all. I have been working on this macro designed to split a BOM at the row of your choice. I am very new at this and have been testing and testing and have finally got to the point where it splits. I was wondering if anyone could assist with adding a user form asking what row it splits at. I also want to move it to the side as well but I'm sure I can get that on m own. WE NEED MORE TUTORIALS ON USER FORMS. I would really appreciate some assistance.

 

 

Dim swApp As SldWorks.SldWorks
Dim swmodel As SldWorks.ModelDoc2
Dim swselectionmanager As SldWorks.SelectionMgr
Dim ParentBOMTable As SldWorks.TableAnnotation
Dim NewBOMTable As SldWorks.TableAnnotation
Dim NEWBOM As SldWorks.Annotation

Sub Main()
'get swrks application
Set swApp = Application.SldWorks
Set swmodel = swApp.ActivateDoc
Set swselectionmanager = swmodel.SelectionManager
Set ParentBOMTable = swselectionmanager.GetSelectedObject6(1, 0)
Set NewBOMTable = ParentBOMTable.Split(SwConst.swTableSplit_AfterRow, 1)
Set NEWBOM = NewBOMTable.GetAnnotation
Dim position As Variant
position = NEWBOM.GetPosition
Stop
'clear
swmodel.ClearSelection
Stop
'select bottom bom
Dim Ret As Boolean
Ret = swmodel.Extension.SelectByID2("", "ANNOTATIONTABLES", position(0), position(1), position(2), False, 0, Nothing, 0)

End Sub

Outcomes