D
Debug.print Bottom Code , Result
PART NUMBER 材料 质量 QTY.
1 件号1-3法兰 16MnII 11.33 1
2 件号1-4接管 20 6.30 1
My question
How to change "件号1-4接管" to "Pipe" ("件号1-4接管" replace "Pipe")
Programe Code
Dim swApp As SldWorks.SldWorks
Dim DrawDoc As SldWorks.DrawingDoc
Dim TableAnn As SldWorks.TableAnnotation
Dim BOM As SldWorks.BomTableAnnotation '.TableAnnotation ' This can be either type
Dim View As SldWorks.View
Sub main()
Set swApp = Application.SldWorks
Set DrawDoc = swApp.ActiveDoc
Set View = DrawDoc.GetFirstView ' this is the sheet
Set TableAnn = View.GetFirstTableAnnotation
Do While Not TableAnn Is Nothing
If TableAnn.Type = 2 Then '2 is the bom table type
Set BOM = TableAnn
Exit Do
End If
Set TableAnn = TableAnn.GetNext
Loop
If BOM Is Nothing Then
Debug.Print ("BOM was not found")
Else
Dim Txt As String
Dim Row As Long
Dim Col As Long
For Row = 0 To BOM.RowCount - 1
Txt = ""
For Col = 0 To BOM.ColumnCount - 1
Txt = Txt & BOM.Text(Row, Col) & vbTab
Next Col
Debug.Print Txt
Next Row
End If
Debug.Print "Done"
End Sub
--------------
This program from web site --- https://forum.solidworks.com/message/132872#132872
Thank.
SolidworksApi macros