SW Design Table Update Problem.
SW Design Table Update Problem.
(OP)
Hi Group,
I've written a VB6 application which among other things attempts(!) to update some info within design tables - it works sometimes, but the problem is getting the DT to be the active workbook. (there is another WB that must stay open in Excel while the program is running and sometimes it remains as the active WB, so when the program tries to modify the DT it targets the other WB and the DT is unchanged). Code I use is as follows:
swbstat = swPart.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, False, 0, Nothing, swSelectOptionDefault)
swPart.InsertFamilyTableEdit
Set ExcelWB = ExcelApp.ActiveWorkbook
Any suggestions how upon opening the DT it can be forced to be the active WB?
Thx.
David G.
I've written a VB6 application which among other things attempts(!) to update some info within design tables - it works sometimes, but the problem is getting the DT to be the active workbook. (there is another WB that must stay open in Excel while the program is running and sometimes it remains as the active WB, so when the program tries to modify the DT it targets the other WB and the DT is unchanged). Code I use is as follows:
swbstat = swPart.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, False, 0, Nothing, swSelectOptionDefault)
swPart.InsertFamilyTableEdit
Set ExcelWB = ExcelApp.ActiveWorkbook
Any suggestions how upon opening the DT it can be forced to be the active WB?
Thx.
David G.






RE: SW Design Table Update Problem.
Set swDesignTable = swModel.GetDesignTable
swDesignTable.EditFeature
Another method you could try would be to get the name of the workbook that is always open and then cycle through all the open workbooks. The one that does not match the known open workbook would then be the design table.
Regards,
Regg
RE: SW Design Table Update Problem.
Your open table method doesn't seem to work much differently than mine (although a bit sexier).
FYI DTs always open in Solidworks.
Cheers, David.
RE: SW Design Table Update Problem.
Regards,
Regg
RE: SW Design Table Update Problem.
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.SetUserPreferenceToggle SwConst.swUserPreferenceToggle_e.swEditDesignTableInSeparateWindow, True
boolstatus = Part.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, False, 0, Nothing, 0)
Part.InsertFamilyTableEdit
End Sub
RE: SW Design Table Update Problem.
I generally do not use the SelectByID calls because the people at SolidWorks API have led me to believe they are not that reliable (though it is funny that when you record a macro that this is the call that generally is recorded). Thanks for the info about the user preference.
Regards,
Regg