第1个回答 2015-07-22
Dim swApp As Object
Dim c As String
Dim i As String
Dim j As String
Dim temp As String
Sub main()
Set swApp = Application.SldWorks
Set part = swApp.ActiveDoc
c = part.GetTitle()
a = InStr(c, " ") - 1
i = Left(c, a)
j = Mid(c, a + 2)
'part.CustomInfo("代号") = i
'part.CustomInfo("名称") = j
part.DeleteCustomInfo ("代号")
part.DeleteCustomInfo ("名称")
temp = part.AddCustomInfo3("", "代号", swCustomInfoText, i)
temp = part.AddCustomInfo3("", "名称", swCustomInfoText, j)
End Sub