我 怀疑是 改这个 SaveAText,
value = swTableAnnotation.SaveAsText(FileName, Separator) '表格另存为TXT文件
' ****************
' BOM TO TEXT
' ****************
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swTableAnnotation As SldWorks.TableAnnotation
Dim FileName As String
Dim Separator As String
Dim value As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc '
If Part Is Nothing Then Exit Sub
If (swSelMgr.GetSelectedObjectCount = 0 Or Not (swSelMgr.GetSelectedObjectType(1) = swSelANNOTATIONTABLES)) Then
MsgBox "请在视图中选择BOM表格"
Exit Sub
End If
Set swTableAnnotation = swSelMgr.GetSelectedObject6(1, -1) '选择为表格
value = swTableAnnotation.SaveAsText(FileName, Separator) '表格另存为TXT文件 我 怀疑是 改这个 SaveAText,
If value Then
MsgBox "BOM表格已另存为" & FileName
'Part.ClearSelection
End If
End Sub 作者: makejon 时间: 2018-10-5 09:19
也是打不开作者: 735057167 时间: 2020-5-12 19:07
exApp.workbooks.Open("D:\123.xls") 这样就可以了作者: xiaocake 时间: 2020-5-17 11:21 本帖最后由 xiaocake 于 2020-5-17 15:41 编辑