AnsweredAssumed Answered

HorizontalAutoSplit API HELP

Question asked by Training User 12 on Apr 5, 2019

I am new to Solidworks API and i keep getting the 424 error object required. I CAN NOT FIGURE OUT WHY. I cant figure out what is not being declared correctly due to my lack of knowledge to Solidoworks API.


I am trying to use the HorizontalAutoSplit to split my BOM (on drawing) at a certain number. For example, i have it being split at 7. I know i can use EditCut and Paste and tell it where to go but that's not what i want. The code works and functions, i just keep receiving the error. Hopefully there is someone out there who can help me.




Sub split()


Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swSelectionManager As SldWorks.SelectionMgr

Dim ParentBom As SldWorks.TableAnnotation

Dim newParentBom As SldWorks.TableAnnotation


Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swSelectionManager = swModel.SelectionManager

Set ParentBom = swSelectionManager.GetSelectedObject6(1, 0)     'i select the BOM here

Set newParentBom = ParentBom.HorizontalAutoSplit(7, 0, 0)


End Sub