求助,帮我看看错在哪里
Private Sub CommandButton1_Click()Dim sSet As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim xx As AcadText
ftype(0) = 0
fdata(0) = "TEXT"
With ThisDrawing
On Error Resume Next
If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
Set sSet = .SelectionSets.Item("MySetSelectionSet")
CreateSelectionSet.Delete
End If
Set sSet = .SelectionSets.Add("MySetSelectionSet")
End With
sSet.Select acSelectionSetAll, , , ftype, fdata
sco = sSet.Count
xx = sSet.Item(1)
ass.Delete
End Sub
我想用xx变量得到选择集内的某个元素(文字),这么写不对,该怎么写
1).CreateSelectionSet.Delete的CreateSelectionSet是否有误?是否应该为sSet
2).xx = sSet.Item(1)前面加上Set,对象赋值需要Set
3).ass.Delete的ass又是什么?
Private Sub Test()
Dim sco As Integer
Dim sSet As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim xx As AcadText
ftype(0) = 0
fdata(0) = "TEXT"
With ThisDrawing
On Error Resume Next
If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
Set sSet = .SelectionSets.Item("MySetSelectionSet")
sSet.Delete
End If
Set sSet = .SelectionSets.Add("MySetSelectionSet")
End With
sSet.Select acSelectionSetAll, , , ftype, fdata
sco = sSet.Count
Set xx = sSet.Item(1)
xx.color = acBlue
End Sub
这样可以了,你参考一下
页:
[1]