<?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: Checking if something exists in a collection in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336392#M86480</link>
    <description>Four words: On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
BTW, that is one obnoxious signature you have there not to metnion&lt;BR /&gt;
rather non-sensical given the fact that you posted a question to no&lt;BR /&gt;
specific person in a public forum.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
Win a free autographed copy of&lt;BR /&gt;
"AutoCAD 2000 VBA Programmer's Reference"&lt;BR /&gt;
by Joe Sutphin&lt;BR /&gt;
&lt;BR /&gt;
"Viney, Scott" &lt;SVINEY&gt; wrote in message&lt;BR /&gt;
news:3AA81F0D.ADF2FFCA@skm.com.au...&lt;BR /&gt;
What am I doing wrong here?&lt;BR /&gt;
How do I check to see if an item exists in collection?  This bombs out&lt;BR /&gt;
at the red line.&lt;BR /&gt;
Sub Test()&lt;BR /&gt;
    Dim acdTxtStylesColl As AcadTextStyles&lt;BR /&gt;
    Dim strTxtStyleName As String&lt;BR /&gt;
&lt;BR /&gt;
    strTxtStyleName = "ISO3098B"&lt;BR /&gt;
&lt;BR /&gt;
    Set acdTxtStylesColl = ThisDrawing.TextStyles&lt;BR /&gt;
&lt;BR /&gt;
    If acdTxtStylesColl.Item("strTxtStyleName") Then&lt;BR /&gt;
        MsgBox "STYLE EXISTS"&lt;BR /&gt;
    End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;SNIP&gt;&lt;/SNIP&gt;&lt;/SVINEY&gt;</description>
    <pubDate>Thu, 08 Mar 2001 17:09:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-03-08T17:09:36Z</dc:date>
    <item>
      <title>Checking if something exists in a collection</title>
      <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336391#M86479</link>
      <description>&lt;BR /&gt;
&lt;BR /&gt;
What am I doing wrong here?&lt;BR /&gt;
&lt;P&gt;How do I check to see if an item exists in collection?&amp;nbsp; This bombs&lt;BR /&gt;
out at the red line.&lt;BR /&gt;
&lt;/P&gt;&lt;P&gt;Sub Test()&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim acdTxtStylesColl As AcadTextStyles&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strTxtStyleName As String&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strTxtStyleName = "ISO3098B"&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set acdTxtStylesColl = ThisDrawing.TextStyles&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color="#FF0000"&gt; If acdTxtStylesColl.Item("strTxtStyleName")&lt;BR /&gt;
Then&lt;/FONT&gt;&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "STYLE EXISTS"&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;
&lt;BR /&gt;End Sub&lt;BR /&gt;
&lt;/P&gt;&lt;P&gt;--&lt;BR /&gt;
&lt;BR /&gt;NOTICE: This message contains privileged and confidential information&lt;BR /&gt;
&lt;BR /&gt;intended only for the use of the addressee named above. If you are&lt;BR /&gt;
not&lt;BR /&gt;
&lt;BR /&gt;the intended recipient of this message you are hereby notified that&lt;BR /&gt;
you&lt;BR /&gt;
&lt;BR /&gt;must not disseminate, copy or take any action in reliance on it. If&lt;BR /&gt;
you&lt;BR /&gt;
&lt;BR /&gt;have received this message in error please notify Sinclair Knight Merz&lt;BR /&gt;
&lt;BR /&gt;Pty Ltd immediately. Any views expressed in this message are those&lt;BR /&gt;
of&lt;BR /&gt;
&lt;BR /&gt;the individual sender, except where the sender has the authority to&lt;BR /&gt;
&lt;BR /&gt;issue and specifically states them to be the views of Sinclair Knight&lt;BR /&gt;
&lt;BR /&gt;Merz.&lt;BR /&gt;
&lt;BR /&gt;--&lt;BR /&gt;
&lt;BR /&gt;CAUTIONARY NOTES CONCERNING THE USE OF ELECTRONICALLY TRANSFERRED DATA&lt;BR /&gt;
&lt;BR /&gt;SINCLAIR KNIGHT MERZ&lt;BR /&gt;
&lt;BR /&gt;--&lt;BR /&gt;
&lt;BR /&gt;The documentation produced by using this electronic data is uncontrolled&lt;BR /&gt;
&lt;BR /&gt;and not subject to&lt;BR /&gt;
&lt;BR /&gt;update. The recipient is responsible for reviewing the status of the&lt;BR /&gt;
&lt;BR /&gt;transferred information and&lt;BR /&gt;
&lt;BR /&gt;should advise Sinclair Knight Merz immediately upon receipt of any&lt;BR /&gt;
&lt;BR /&gt;discrepancy. The design&lt;BR /&gt;
&lt;BR /&gt;and details are applicable to the intended project only and must not&lt;BR /&gt;
be&lt;BR /&gt;
&lt;BR /&gt;reproduced wholly or&lt;BR /&gt;
&lt;BR /&gt;in part, or supplied to any third party without the written permission&lt;BR /&gt;
&lt;BR /&gt;of Sinclair Knight Merz&lt;BR /&gt;
&lt;BR /&gt;who retains copyright of all the transmitted material&lt;BR /&gt;
&lt;BR /&gt;--&lt;BR /&gt;
&lt;BR /&gt;The sender makes no warranty regarding the presence of electronic or&lt;BR /&gt;
&lt;BR /&gt;magnetic data errors&lt;BR /&gt;
&lt;BR /&gt;or computer viruses, or as to the accuracy or completeness of the data&lt;BR /&gt;
&lt;BR /&gt;transmitted.&lt;BR /&gt;
&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2001 16:08:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336391#M86479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-08T16:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if something exists in a collection</title>
      <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336392#M86480</link>
      <description>Four words: On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
BTW, that is one obnoxious signature you have there not to metnion&lt;BR /&gt;
rather non-sensical given the fact that you posted a question to no&lt;BR /&gt;
specific person in a public forum.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
Win a free autographed copy of&lt;BR /&gt;
"AutoCAD 2000 VBA Programmer's Reference"&lt;BR /&gt;
by Joe Sutphin&lt;BR /&gt;
&lt;BR /&gt;
"Viney, Scott" &lt;SVINEY&gt; wrote in message&lt;BR /&gt;
news:3AA81F0D.ADF2FFCA@skm.com.au...&lt;BR /&gt;
What am I doing wrong here?&lt;BR /&gt;
How do I check to see if an item exists in collection?  This bombs out&lt;BR /&gt;
at the red line.&lt;BR /&gt;
Sub Test()&lt;BR /&gt;
    Dim acdTxtStylesColl As AcadTextStyles&lt;BR /&gt;
    Dim strTxtStyleName As String&lt;BR /&gt;
&lt;BR /&gt;
    strTxtStyleName = "ISO3098B"&lt;BR /&gt;
&lt;BR /&gt;
    Set acdTxtStylesColl = ThisDrawing.TextStyles&lt;BR /&gt;
&lt;BR /&gt;
    If acdTxtStylesColl.Item("strTxtStyleName") Then&lt;BR /&gt;
        MsgBox "STYLE EXISTS"&lt;BR /&gt;
    End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;SNIP&gt;&lt;/SNIP&gt;&lt;/SVINEY&gt;</description>
      <pubDate>Thu, 08 Mar 2001 17:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336392#M86480</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-08T17:09:36Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336393#M86481</link>
      <description>Frank,&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the work blurb.  But can you explain how to the On Error&lt;BR /&gt;
Resume Next will work?  I jsut want to test if an object exists within a&lt;BR /&gt;
collection.&lt;BR /&gt;
&lt;BR /&gt;
Cheers mate&lt;BR /&gt;
&lt;BR /&gt;
Scott V&lt;BR /&gt;
&lt;BR /&gt;
Frank Oquendo wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Four words: On Error Resume Next&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; BTW, that is one obnoxious signature you have there not to metnion&lt;BR /&gt;
&amp;gt; rather non-sensical given the fact that you posted a question to no&lt;BR /&gt;
&amp;gt; specific person in a public forum.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; http://www.acadx.com&lt;BR /&gt;
&amp;gt; Win a free autographed copy of&lt;BR /&gt;
&amp;gt; "AutoCAD 2000 VBA Programmer's Reference"&lt;BR /&gt;
&amp;gt; by Joe Sutphin&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Viney, Scott" &lt;SVINEY&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:3AA81F0D.ADF2FFCA@skm.com.au...&lt;BR /&gt;
&amp;gt; What am I doing wrong here?&lt;BR /&gt;
&amp;gt; How do I check to see if an item exists in collection?  This bombs out&lt;BR /&gt;
&amp;gt; at the red line.&lt;BR /&gt;
&amp;gt; Sub Test()&lt;BR /&gt;
&amp;gt;     Dim acdTxtStylesColl As AcadTextStyles&lt;BR /&gt;
&amp;gt;     Dim strTxtStyleName As String&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     strTxtStyleName = "ISO3098B"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Set acdTxtStylesColl = ThisDrawing.TextStyles&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     If acdTxtStylesColl.Item("strTxtStyleName") Then&lt;BR /&gt;
&amp;gt;         MsgBox "STYLE EXISTS"&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt; &lt;SNIP&gt;&lt;/SNIP&gt;&lt;/SVINEY&gt;</description>
      <pubDate>Thu, 08 Mar 2001 20:39:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336393#M86481</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-08T20:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if something exists in a collection</title>
      <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336394#M86482</link>
      <description>Hi Scott,&lt;BR /&gt;
Something along this line..&lt;BR /&gt;
&lt;BR /&gt;
Public Function DoesStyleExist(strTxtStyleName As String) As Boolean&lt;BR /&gt;
  Dim acdTxtStylesColl As AcadTextStyles&lt;BR /&gt;
  Dim acdTxtStyle As AcadTextStyle&lt;BR /&gt;
  On Error Resume Next&lt;BR /&gt;
  Set acdTxtStylesColl = ThisDrawing.TextStyles&lt;BR /&gt;
  Set acdTxtStyle = acdTxtStylesColl.Item(strTxtStyleName)&lt;BR /&gt;
  DoesStyleExist = (Err.Number = 0)&lt;BR /&gt;
  Err.Clear&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Randall Rath</description>
      <pubDate>Thu, 08 Mar 2001 20:57:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336394#M86482</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-08T20:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if something exists in a collection</title>
      <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336395#M86483</link>
      <description>Drop the inverted commas inside the bracket. As it stands it is looking for an item called strTxtStyleName rather than the string that the variable strTxtStyleName refers tp</description>
      <pubDate>Fri, 09 Mar 2001 03:14:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336395#M86483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-09T03:14:51Z</dc:date>
    </item>
    <item>
      <title>R: Checking if something exists in a collection</title>
      <link>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336396#M86484</link>
      <description>You should try somthing like this&lt;BR /&gt;
&amp;gt; &amp;gt; Sub Test()&lt;BR /&gt;
&amp;gt; &amp;gt;     Dim acdTxtStylesColl As AcadTextStyles&lt;BR /&gt;
&amp;gt; &amp;gt;     Dim strTxtStyleName As String&lt;BR /&gt;
          Dim acdTxtStyle as AcadTextStyle&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;     strTxtStyleName = "ISO3098B"&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;     Set acdTxtStylesColl = ThisDrawing.TextStyles&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
          On Error GoTo EssSt&lt;BR /&gt;
          Set acdTxtStyle= acdTxtStylesColl.Item("strTxtStyleName")&lt;BR /&gt;
          On Error Goto 0&lt;BR /&gt;
---------&lt;BR /&gt;
--------&lt;BR /&gt;
          Exit Sub&lt;BR /&gt;
SomeThing:&lt;BR /&gt;
--------&lt;BR /&gt;
--------&lt;BR /&gt;
          Ext Sub&lt;BR /&gt;
EssSt: MsgBox "It does not extist"&lt;BR /&gt;
          Resume Something&lt;BR /&gt;
End Sub&lt;BR /&gt;
&amp;gt;</description>
      <pubDate>Sun, 11 Mar 2001 10:56:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/checking-if-something-exists-in-a-collection/m-p/336396#M86484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-03-11T10:56:38Z</dc:date>
    </item>
  </channel>
</rss>

