I have a macro to make a general table and fill in some cells.
When I stop the macro, move the general table's position and restart the macro, the macro needs to pick up that general table (name of general table is WeldNumbers) to be able te add rows and continue.
When I do not move the table then the macro can find that same table because the x and y values are the same as when first inserted
value = instance.SelectByID2(Name, Type, X, Y, Z, Append, Mark, Callout, SelectOption)
My problem is that when I move the table, then I can not set swTable to the selected swSubFeat
How can I set swTable by selecting the "WeldNumbers" table?
.....
If swTable Is Nothing Then
Do Until swFeature Is Nothing
'Debug.Print swFeature.Name, swFeature.GetTypeName
Set swSubFeat = swFeature.GetFirstSubFeature
Do Until swSubFeat Is Nothing
'Debug.Print swSubFeat.Name, swSubFeat.GetTypeName
If swSubFeat.Name = "WeldNumbers" And swSubFeat.GetTypeName = "GeneralTableFeature" Then
booEnableEvents = False
booWeldTableExcists = True
swModel.ClearSelection2 True
swSubFeat.Select (False)
'Set swTable = swSubFeat '<-- this does not work
boolstatus = swModel.Extension.SelectByID2("WeldNumbers", swSelGENERALTABLEFEAT, _
0.01, 0.275, 0, False, 0, Nothing, swSelectOptionDefault) '<-- this needs x and y coordinates but if moved then x and y are changes
Set swTable = swModel.SelectionManager.GetSelectedObject5(1)
booEnableEvents = True
AantalRijenTabel = swTable.RowCount
UserForm1.txtWledNr.value = swTable.RowCount
UserForm1.SpinButton1.value = UserForm1.txtWledNr.value
Exit Do
End If
Set swSubFeat = swSubFeat.GetNextSubFeature
Loop
If booWeldTableExcists = True Then Exit Do
Set swFeature = swFeature.GetNextFeature
Loop
End If
....
Thx for any help,
Frank
SolidworksApi/macros