I am looking for a VBA macro function or method that accomplishes the same thing as right clicking on a BOM Table cell and pressing "Restore Original Value". I have searched the Solidworks API help, but can't find anything like it.
You just need to set the text of the cell to "Empty".
Example for the cell on row #2 and column #2:
Option ExplicitSub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swDraw As SldWorks.DrawingDoc Dim swView As SldWorks.View Dim swTable As SldWorks.TableAnnotation Dim CellRowNum As Long Dim CellColNum As Long CellRowNum = 1 CellColNum = 1 Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swDraw = swModel Set swView = swDraw.GetFirstView Set swTable = swView.GetFirstTableAnnotation While Not swTable Is Nothing If swTable.Type = swTableAnnotationType_e.swTableAnnotation_BillOfMaterials Then swTable.Text(CellRowNum, CellColNum) = Empty End If Set swTable = swTable.GetNext WendEnd Sub
Thank you, I'll give it a shot!
That works great. Thank you.
That Worked Great!
Retrieving data ...