|
发表于 2004-4-15 18:39:26
|
显示全部楼层
我好像收到了一条奇怪的错误信息。我在网上查到的,其实没什么意义。我做了一个选择案例来检查它是否有错误消息,如果是,则继续下一步。明天上班的时候我会把代码发出去,以防有人想要 0 Then
YesNo = MsgBox("You Have " & SelSet.Count & " Attribute
Definition(s) in " & ThisDrawing.Name & _
". Would you like this program to attempt to convert them to text?",
_
vbYesNo + vbCritical + vbDefaultButton1)
'if "Ok" is pressed then try to replace all of the attribute
definitions with text that has the same properties.
If YesNo = vbYes Then
For Each AT In SelSet
Set TXT = ThisDrawing.ModelSpace.AddText(AT.TagString,
AT.InsertionPoint, AT.Height)
TXT.Alignment = AT.Alignment
TXT.TextAlignmentPoint = AT.TextAlignmentPoint
TXT.Layer = AT.Layer
TXT.Color = AT.Color
TXT.Rotation = AT.Rotation
TXT.Update
AT.Delete
Next
End If
End If
'clear the selection set
SelSet.Clear
'rescan the drawing for attribute definitions
SelSet.Select acSelectionSetAll, , , FilterType, FilterData
'if it the count is zero then it worked.
If SelSet.Count = 0 Then
MsgBox "All attributes were converted to text."
Else:
MsgBox "Failed to convert all attributes to text."
End If
Exit_Error:
Select Case Err.Number
Case -2145386494 'not applicable
Resume Next
Case Else
SelSet.Delete
Set SelSet = Nothing
Set AT = Nothing
Set TXT = Nothing
End Select
End Sub
[/code]
|
|