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