<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Selection Set length in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330910#M18219</link>
    <description>hi, i am just new to VBA so please do not mind &lt;BR /&gt;
here i want to go through the selection set and display the name every entity of the selection set please can u help.&lt;BR /&gt;
thanks&lt;BR /&gt;
&lt;BR /&gt;
Private Sub cmdBt1_Click()&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim Sset As AcadSelectionSet&lt;BR /&gt;
Dim Count As Integer&lt;BR /&gt;
Dim Eobject As AcadEntity&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Form1.hide&lt;BR /&gt;
Pt1 = ThisDrawing.Utility.GetPoint(, "Select the First Point")&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Select the Second Point")&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
ThisDrawing.SelectionSets.Item(Sset).Delete&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Add("Sset")&lt;BR /&gt;
Sset.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
Form1.Show&lt;BR /&gt;
Form1.txtbox1.Text = str(Sset.Count)&lt;BR /&gt;
'MsgBox "Count = " &amp;amp; Sset.Count&lt;BR /&gt;
Unload Form1&lt;BR /&gt;
&lt;BR /&gt;
'Type of Entities&lt;BR /&gt;
Dim objstring As String&lt;BR /&gt;
For Each Eobject In Sset&lt;BR /&gt;
objstring = objstring &amp;amp; vbCr &amp;amp; Sset.Name&lt;BR /&gt;
Next&lt;BR /&gt;
   MsgBox objstring, , "List of Selection Sets"&lt;BR /&gt;
End Sub</description>
    <pubDate>Sun, 31 Aug 2008 05:25:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-08-31T05:25:18Z</dc:date>
    <item>
      <title>Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330905#M18214</link>
      <description>Hi,&lt;BR /&gt;
If u do not mind than please tell me in the program below how to calculate the length of selection set.&lt;BR /&gt;
thanks&lt;BR /&gt;
&lt;BR /&gt;
Private Sub cmdBt1_Click()&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim sslength As Integer&lt;BR /&gt;
Form1.hide&lt;BR /&gt;
Pt1 = ThisDrawing.Utility.GetPoint(, "Select First Point")&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(, "Select Second Point")&lt;BR /&gt;
&lt;BR /&gt;
'create Sset object first&lt;BR /&gt;
ss.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
&lt;BR /&gt;
Set ss = ThisDrawing.SelectionSets.Item("MySSet")&lt;BR /&gt;
If ss Is Nothing Then&lt;BR /&gt;
Set ss = ThisDrawing.SelectionSets.Add("MySSet")&lt;BR /&gt;
End If&lt;BR /&gt;
sslength = AutoCAD.Application.ActiveDocument.SelectionSets.SelectionSet.count&lt;BR /&gt;
End Sub</description>
      <pubDate>Wed, 27 Aug 2008 11:04:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330905#M18214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T11:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330906#M18215</link>
      <description>This is from a post I made on August 5.&lt;BR /&gt;
&lt;BR /&gt;
Joe ...&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Test()&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim Sset As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
  Pt1 = ThisDrawing.Utility.GetPoint(, "Select the First Point")&lt;BR /&gt;
  Pt2 = ThisDrawing.Utility.GetPoint(, "Select the Second Point")&lt;BR /&gt;
&lt;BR /&gt;
  'create Sset object first&lt;BR /&gt;
  Set Sset = ThisDrawing.SelectionSets.Add("Sset")&lt;BR /&gt;
&lt;BR /&gt;
  Sset.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
&lt;BR /&gt;
  MsgBox "Count = " &amp;amp; Sset.Count&lt;BR /&gt;
&lt;BR /&gt;
  'get rid of selection set&lt;BR /&gt;
  Sset.Delete&lt;BR /&gt;
  Set Sset = Nothing&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KULFI&gt; wrote in message news:6016911@discussion.autodesk.com...&lt;BR /&gt;
Hi,&lt;BR /&gt;
If u do not mind than please tell me in the program below how to calculate &lt;BR /&gt;
the length of selection set.&lt;BR /&gt;
thanks&lt;BR /&gt;
&lt;BR /&gt;
Private Sub cmdBt1_Click()&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
Dim ss As AcadSelectionSet&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim sslength As Integer&lt;BR /&gt;
Form1.hide&lt;BR /&gt;
Pt1 = ThisDrawing.Utility.GetPoint(, "Select First Point")&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(, "Select Second Point")&lt;BR /&gt;
&lt;BR /&gt;
'create Sset object first&lt;BR /&gt;
ss.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
&lt;BR /&gt;
Set ss = ThisDrawing.SelectionSets.Item("MySSet")&lt;BR /&gt;
If ss Is Nothing Then&lt;BR /&gt;
Set ss = ThisDrawing.SelectionSets.Add("MySSet")&lt;BR /&gt;
End If&lt;BR /&gt;
sslength = &lt;BR /&gt;
AutoCAD.Application.ActiveDocument.SelectionSets.SelectionSet.count&lt;BR /&gt;
End Sub&lt;/KULFI&gt;</description>
      <pubDate>Wed, 27 Aug 2008 12:30:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330906#M18215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-27T12:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330907#M18216</link>
      <description>hi,&lt;BR /&gt;
in the program below i am getting one error that is "The Name Selection Set Exist"&lt;BR /&gt;
Can u tell what is that and why this problem is appearing while in the this problem is not there.&lt;BR /&gt;
&lt;BR /&gt;
Private Sub cmdBt1_Click()&lt;BR /&gt;
'On Error Resume Next&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim Sset As AcadSelectionSet&lt;BR /&gt;
Dim Count As Integer&lt;BR /&gt;
&lt;BR /&gt;
Form1.hide&lt;BR /&gt;
Pt1 = ThisDrawing.Utility.GetPoint(, "Select the First Point")&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Select the Second Point")&lt;BR /&gt;
'Create Sset object first&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Add("Sset")&lt;BR /&gt;
&lt;BR /&gt;
Sset.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
'Form1.Show&lt;BR /&gt;
'TxtBox1.Text = Sset.Count&lt;BR /&gt;
&lt;BR /&gt;
MsgBox "Count = " &amp;amp; Sset.Count&lt;BR /&gt;
&lt;BR /&gt;
'get rid of selection set&lt;BR /&gt;
Sset.Delete&lt;BR /&gt;
Set Sset = Nothing&lt;BR /&gt;
End Sub</description>
      <pubDate>Sat, 30 Aug 2008 07:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330907#M18216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-30T07:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330908#M18217</link>
      <description>hi,&lt;BR /&gt;
IN the begning it is wroking good but later on error is coming and also nothing is highlighted in the text box1.&lt;BR /&gt;
Please Tell me where the problem is.&lt;BR /&gt;
thanks&lt;BR /&gt;
Private Sub cmdBt1_Click()&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim Sset As AcadSelectionSet&lt;BR /&gt;
Dim Count As Integer&lt;BR /&gt;
&lt;BR /&gt;
Form1.hide&lt;BR /&gt;
Pt1 = ThisDrawing.Utility.GetPoint(, "Select the First Point")&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Select the Second Point")&lt;BR /&gt;
'Create Sset object first&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Item("Myss")&lt;BR /&gt;
If Sset Is Nothing Then&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Add("Myss")&lt;BR /&gt;
Else&lt;BR /&gt;
Sset.Clear&lt;BR /&gt;
End If&lt;BR /&gt;
Sset.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
Form1.Show&lt;BR /&gt;
txtbox1.Text = Str(Sset.Count)&lt;BR /&gt;
MsgBox "Count = " &amp;amp; Sset.Count&lt;BR /&gt;
&lt;BR /&gt;
'get rid of selection set&lt;BR /&gt;
Sset.Delete&lt;BR /&gt;
Set Sset = Nothing&lt;BR /&gt;
End Sub</description>
      <pubDate>Sat, 30 Aug 2008 09:25:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330908#M18217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-30T09:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330909#M18218</link>
      <description>one way is to replace&lt;BR /&gt;
&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Item("Myss")&lt;BR /&gt;
If Sset Is Nothing Then&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Add("Myss")&lt;BR /&gt;
Else&lt;BR /&gt;
Sset.Clear&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
with&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
ThisDrawing.SelectionSets.Item("Myss").delete&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
Set sset = ThisDrawing.SelectionSets.Add("Myss")&lt;BR /&gt;
&lt;BR /&gt;
also &lt;BR /&gt;
Form1.txtbox1.Text = Str(Sset.Count) &lt;BR /&gt;
might be needed</description>
      <pubDate>Sat, 30 Aug 2008 18:43:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330909#M18218</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-30T18:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330910#M18219</link>
      <description>hi, i am just new to VBA so please do not mind &lt;BR /&gt;
here i want to go through the selection set and display the name every entity of the selection set please can u help.&lt;BR /&gt;
thanks&lt;BR /&gt;
&lt;BR /&gt;
Private Sub cmdBt1_Click()&lt;BR /&gt;
Dim Pt1 As Variant&lt;BR /&gt;
Dim Pt2 As Variant&lt;BR /&gt;
Dim Sset As AcadSelectionSet&lt;BR /&gt;
Dim Count As Integer&lt;BR /&gt;
Dim Eobject As AcadEntity&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Form1.hide&lt;BR /&gt;
Pt1 = ThisDrawing.Utility.GetPoint(, "Select the First Point")&lt;BR /&gt;
Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Select the Second Point")&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
ThisDrawing.SelectionSets.Item(Sset).Delete&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
Set Sset = ThisDrawing.SelectionSets.Add("Sset")&lt;BR /&gt;
Sset.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
Form1.Show&lt;BR /&gt;
Form1.txtbox1.Text = str(Sset.Count)&lt;BR /&gt;
'MsgBox "Count = " &amp;amp; Sset.Count&lt;BR /&gt;
Unload Form1&lt;BR /&gt;
&lt;BR /&gt;
'Type of Entities&lt;BR /&gt;
Dim objstring As String&lt;BR /&gt;
For Each Eobject In Sset&lt;BR /&gt;
objstring = objstring &amp;amp; vbCr &amp;amp; Sset.Name&lt;BR /&gt;
Next&lt;BR /&gt;
   MsgBox objstring, , "List of Selection Sets"&lt;BR /&gt;
End Sub</description>
      <pubDate>Sun, 31 Aug 2008 05:25:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330910#M18219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-31T05:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Set length</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330911#M18220</link>
      <description>Hi kulfi,&lt;BR /&gt;
&lt;BR /&gt;
If you want to be a programmer, you are going to have to learn to do &lt;BR /&gt;
some work and think for yourself.&lt;BR /&gt;
&lt;BR /&gt;
Why do you expect every time you clipboard something together that &lt;BR /&gt;
readers of this newsgroup are going to do the work for you?&lt;BR /&gt;
&lt;BR /&gt;
I suggest you step through this code yourself with the F8 key and find &lt;BR /&gt;
the errors and THINK about what may be causing them.  Then try to fix &lt;BR /&gt;
them yourself if you can.  That way you will learn something.&lt;BR /&gt;
&lt;BR /&gt;
If you are really stumped then post an explanation of what you did to &lt;BR /&gt;
fix your problem and make it easier for others to help you.&lt;BR /&gt;
&lt;BR /&gt;
Admittedly the error in the line:&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.SelectionSets.Item(Sset).Delete&lt;BR /&gt;
&lt;BR /&gt;
may prove hard to find as you are bypassing the error in it with the line:&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next.&lt;BR /&gt;
&lt;BR /&gt;
Look at the sample code you were given by Cadger and fix this error &lt;BR /&gt;
yourself before moving on the the errors of logic and common sense in &lt;BR /&gt;
the rest of the code.  All of these will be obvious as you step through &lt;BR /&gt;
the code.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Laurie Comerford&lt;BR /&gt;
&lt;BR /&gt;
kulfi wrote:&lt;BR /&gt;
&amp;gt; hi, i am just new to VBA so please do not mind &lt;BR /&gt;
&amp;gt; here i want to go through the selection set and display the name every entity of the selection set please can u help.&lt;BR /&gt;
&amp;gt; thanks&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Private Sub cmdBt1_Click()&lt;BR /&gt;
&amp;gt; Dim Pt1 As Variant&lt;BR /&gt;
&amp;gt; Dim Pt2 As Variant&lt;BR /&gt;
&amp;gt; Dim Sset As AcadSelectionSet&lt;BR /&gt;
&amp;gt; Dim Count As Integer&lt;BR /&gt;
&amp;gt; Dim Eobject As AcadEntity&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Form1.hide&lt;BR /&gt;
&amp;gt; Pt1 = ThisDrawing.Utility.GetPoint(, "Select the First Point")&lt;BR /&gt;
&amp;gt; Pt2 = ThisDrawing.Utility.GetPoint(Pt1, "Select the Second Point")&lt;BR /&gt;
&amp;gt; On Error Resume Next&lt;BR /&gt;
&amp;gt; ThisDrawing.SelectionSets.Item(Sset).Delete&lt;BR /&gt;
&amp;gt; On Error GoTo 0&lt;BR /&gt;
&amp;gt; Set Sset = ThisDrawing.SelectionSets.Add("Sset")&lt;BR /&gt;
&amp;gt; Sset.Select acSelectionSetCrossing, Pt1, Pt2&lt;BR /&gt;
&amp;gt; Form1.Show&lt;BR /&gt;
&amp;gt; Form1.txtbox1.Text = str(Sset.Count)&lt;BR /&gt;
&amp;gt; 'MsgBox "Count = " &amp;amp; Sset.Count&lt;BR /&gt;
&amp;gt; Unload Form1&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; 'Type of Entities&lt;BR /&gt;
&amp;gt; Dim objstring As String&lt;BR /&gt;
&amp;gt; For Each Eobject In Sset&lt;BR /&gt;
&amp;gt; objstring = objstring &amp;amp; vbCr &amp;amp; Sset.Name&lt;BR /&gt;
&amp;gt; Next&lt;BR /&gt;
&amp;gt;    MsgBox objstring, , "List of Selection Sets"&lt;BR /&gt;
&amp;gt; End Sub</description>
      <pubDate>Sun, 31 Aug 2008 10:20:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selection-set-length/m-p/2330911#M18220</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-31T10:20:20Z</dc:date>
    </item>
  </channel>
</rss>

