hd464011547 发表于 2010-6-3 15:42:00

求助,帮我看看错在哪里

<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/>&nbsp;On Error Resume Next<br/>&nbsp;&nbsp;&nbsp;&nbsp; If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set sSet = .SelectionSets.Item("MySetSelectionSet")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CreateSelectionSet.Delete<br/>&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp;&nbsp; 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>

sailorcwx 发表于 2010-6-3 16:29:00

<p>1).CreateSelectionSet.Delete的CreateSelectionSet是否有误?是否应该为sSet </p>
<p>2).xx = sSet.Item(1)前面加上Set,对象赋值需要Set</p>
<p>3).ass.Delete的ass又是什么?</p>

henanlypl 发表于 2010-6-5 11:16:00

<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/>&nbsp;On Error Resume Next<br/>&nbsp;&nbsp;&nbsp;&nbsp; If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set sSet = .SelectionSets.Item("MySetSelectionSet")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sSet.Delete<br/>&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;这样可以了,你参考一下</p>
页: [1]
查看完整版本: 求助,帮我看看错在哪里