<?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 Select Case basics! in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471829#M39421</link>
    <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm tring to have a dabble with VBA! I'm wanting to create a form with buttons that will change various layer properties. Having a few problems with the Select Case syntax......i'd be extremely helpful if someone could point me in the right direction. (I'm currently getting the error 'Object doesn't support this property or method (Error 438)'). So I believe there's something wrong with my dimensioning?&lt;BR /&gt;
&lt;BR /&gt;
Many thanks,&lt;BR /&gt;
&lt;BR /&gt;
Dom&lt;BR /&gt;
&lt;BR /&gt;
*********************************&lt;BR /&gt;
Private Sub cmdLayerState1_Click()&lt;BR /&gt;
&lt;BR /&gt;
Dim objLayer As AcadLayer&lt;BR /&gt;
&lt;BR /&gt;
For Each objLayer In ThisDrawing.Layers&lt;BR /&gt;
&lt;BR /&gt;
Select Case objLayer&lt;BR /&gt;
Case "layer1*"&lt;BR /&gt;
objLayer.LayerOn = False&lt;BR /&gt;
Case "layer222"&lt;BR /&gt;
objLayer.Plottable = False&lt;BR /&gt;
Case "layer333"&lt;BR /&gt;
objLayer.Freeze = True&lt;BR /&gt;
&lt;BR /&gt;
End Select&lt;BR /&gt;
Next&lt;BR /&gt;
Application.Update&lt;BR /&gt;
End Sub&lt;BR /&gt;
***********************************</description>
    <pubDate>Fri, 28 Oct 2005 11:35:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-10-28T11:35:23Z</dc:date>
    <item>
      <title>Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471829#M39421</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm tring to have a dabble with VBA! I'm wanting to create a form with buttons that will change various layer properties. Having a few problems with the Select Case syntax......i'd be extremely helpful if someone could point me in the right direction. (I'm currently getting the error 'Object doesn't support this property or method (Error 438)'). So I believe there's something wrong with my dimensioning?&lt;BR /&gt;
&lt;BR /&gt;
Many thanks,&lt;BR /&gt;
&lt;BR /&gt;
Dom&lt;BR /&gt;
&lt;BR /&gt;
*********************************&lt;BR /&gt;
Private Sub cmdLayerState1_Click()&lt;BR /&gt;
&lt;BR /&gt;
Dim objLayer As AcadLayer&lt;BR /&gt;
&lt;BR /&gt;
For Each objLayer In ThisDrawing.Layers&lt;BR /&gt;
&lt;BR /&gt;
Select Case objLayer&lt;BR /&gt;
Case "layer1*"&lt;BR /&gt;
objLayer.LayerOn = False&lt;BR /&gt;
Case "layer222"&lt;BR /&gt;
objLayer.Plottable = False&lt;BR /&gt;
Case "layer333"&lt;BR /&gt;
objLayer.Freeze = True&lt;BR /&gt;
&lt;BR /&gt;
End Select&lt;BR /&gt;
Next&lt;BR /&gt;
Application.Update&lt;BR /&gt;
End Sub&lt;BR /&gt;
***********************************</description>
      <pubDate>Fri, 28 Oct 2005 11:35:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471829#M39421</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T11:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471830#M39422</link>
      <description>Dom,&lt;BR /&gt;
&lt;BR /&gt;
It should be:     Select Case objLayer.Name&lt;BR /&gt;
&lt;BR /&gt;
Joe&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997339@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm tring to have a dabble with VBA! I'm wanting to create a form with &lt;BR /&gt;
buttons that will change various layer properties. Having a few problems &lt;BR /&gt;
with the Select Case syntax......i'd be extremely helpful if someone could &lt;BR /&gt;
point me in the right direction. (I'm currently getting the error 'Object &lt;BR /&gt;
doesn't support this property or method (Error 438)'). So I believe there's &lt;BR /&gt;
something wrong with my dimensioning?&lt;BR /&gt;
&lt;BR /&gt;
Many thanks,&lt;BR /&gt;
&lt;BR /&gt;
Dom&lt;BR /&gt;
&lt;BR /&gt;
*********************************&lt;BR /&gt;
Private Sub cmdLayerState1_Click()&lt;BR /&gt;
&lt;BR /&gt;
Dim objLayer As AcadLayer&lt;BR /&gt;
&lt;BR /&gt;
For Each objLayer In ThisDrawing.Layers&lt;BR /&gt;
&lt;BR /&gt;
Select Case objLayer&lt;BR /&gt;
Case "layer1*"&lt;BR /&gt;
objLayer.LayerOn = False&lt;BR /&gt;
Case "layer222"&lt;BR /&gt;
objLayer.Plottable = False&lt;BR /&gt;
Case "layer333"&lt;BR /&gt;
objLayer.Freeze = True&lt;BR /&gt;
&lt;BR /&gt;
End Select&lt;BR /&gt;
Next&lt;BR /&gt;
Application.Update&lt;BR /&gt;
End Sub&lt;BR /&gt;
***********************************&lt;/DHORTON&gt;</description>
      <pubDate>Fri, 28 Oct 2005 12:07:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471830#M39422</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T12:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471831#M39423</link>
      <description>Hi Joe,&lt;BR /&gt;
&lt;BR /&gt;
Many thanks for that I'm new to this VBA game.....I've just bought your book too, and it's proving to be very useful!&lt;BR /&gt;
&lt;BR /&gt;
One other thing... I was trying to use wildcards eg "Layer1*"....but this doesn't seem to work, is it looking for an exact match?&lt;BR /&gt;
&lt;BR /&gt;
many thanks&lt;BR /&gt;
dom</description>
      <pubDate>Fri, 28 Oct 2005 12:51:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471831#M39423</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T12:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471832#M39424</link>
      <description>Untested:&lt;BR /&gt;
What happens if you do something like this:&lt;BR /&gt;
&lt;BR /&gt;
Case Like "Layer1*"&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Matt W&lt;BR /&gt;
"Children are like TV sets. When they start acting weird, whack them across &lt;BR /&gt;
the head with a big rubber basketball shoe."&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997412@discussion.autodesk.com...&lt;BR /&gt;
Hi Joe,&lt;BR /&gt;
&lt;BR /&gt;
Many thanks for that I'm new to this VBA game.....I've just bought your book &lt;BR /&gt;
too, and it's proving to be very useful!&lt;BR /&gt;
&lt;BR /&gt;
One other thing... I was trying to use wildcards eg "Layer1*"....but this &lt;BR /&gt;
doesn't seem to work, is it looking for an exact match?&lt;BR /&gt;
&lt;BR /&gt;
many thanks&lt;BR /&gt;
dom&lt;/DHORTON&gt;</description>
      <pubDate>Fri, 28 Oct 2005 13:00:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471832#M39424</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471833#M39425</link>
      <description>Hi Matt,&lt;BR /&gt;
&lt;BR /&gt;
It doesn't like it...I'm getting a compile error&lt;BR /&gt;
&lt;BR /&gt;
cheers&lt;BR /&gt;
&lt;BR /&gt;
dom</description>
      <pubDate>Fri, 28 Oct 2005 13:06:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471833#M39425</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471834#M39426</link>
      <description>I think I can solve in an around-about way using for example,&lt;BR /&gt;
&lt;BR /&gt;
Case "F800" To "G"&lt;BR /&gt;
&lt;BR /&gt;
I'd be interested to know if wild cards can be used.&lt;BR /&gt;
&lt;BR /&gt;
Many thanks &lt;BR /&gt;
Dom</description>
      <pubDate>Fri, 28 Oct 2005 13:14:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471834#M39426</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471835#M39427</link>
      <description>You can use this instead of Select Case (this I know works because I use it &lt;BR /&gt;
all the time).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Matt W&lt;BR /&gt;
"Children are like TV sets. When they start acting weird, whack them across &lt;BR /&gt;
the head with a big rubber basketball shoe."&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997422@discussion.autodesk.com...&lt;BR /&gt;
I think I can solve in an around-about way using for example,&lt;BR /&gt;
&lt;BR /&gt;
Case "F800" To "G"&lt;BR /&gt;
&lt;BR /&gt;
I'd be interested to know if wild cards can be used.&lt;BR /&gt;
&lt;BR /&gt;
Many thanks&lt;BR /&gt;
Dom&lt;/DHORTON&gt;</description>
      <pubDate>Fri, 28 Oct 2005 13:31:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471835#M39427</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471836#M39428</link>
      <description>A little slip of the fingers I guess.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
And here's the code:&lt;BR /&gt;
&lt;BR /&gt;
[code]&lt;BR /&gt;
    Dim lays As AcadLayers&lt;BR /&gt;
    Dim lay As AcadLayer&lt;BR /&gt;
&lt;BR /&gt;
    On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
    Set lays = ThisDrawing.Layers&lt;BR /&gt;
&lt;BR /&gt;
    For Each lay In lays&lt;BR /&gt;
        If UCase$(lay.Name) Like ("LAYER1*") Then lay.LayerOn = False&lt;BR /&gt;
        If UCase$(lay.Name) Like ("LAYER222") Then lay.Plottable = False&lt;BR /&gt;
    Next&lt;BR /&gt;
[/code]&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Matt W&lt;BR /&gt;
"Children are like TV sets. When they start acting weird, whack them across &lt;BR /&gt;
the head with a big rubber basketball shoe."&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Matt W" &lt;SPAMSPAM&gt; wrote in message &lt;BR /&gt;
news:4997462@discussion.autodesk.com...&lt;BR /&gt;
You can use this instead of Select Case (this I know works because I use it&lt;BR /&gt;
all the time).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Matt W&lt;BR /&gt;
"Children are like TV sets. When they start acting weird, whack them across&lt;BR /&gt;
the head with a big rubber basketball shoe."&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997422@discussion.autodesk.com...&lt;BR /&gt;
I think I can solve in an around-about way using for example,&lt;BR /&gt;
&lt;BR /&gt;
Case "F800" To "G"&lt;BR /&gt;
&lt;BR /&gt;
I'd be interested to know if wild cards can be used.&lt;BR /&gt;
&lt;BR /&gt;
Many thanks&lt;BR /&gt;
Dom&lt;/DHORTON&gt;&lt;/SPAMSPAM&gt;</description>
      <pubDate>Fri, 28 Oct 2005 13:32:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471836#M39428</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471837#M39429</link>
      <description>That'll do the job, Many thanks for your help&lt;BR /&gt;
&lt;BR /&gt;
Dom</description>
      <pubDate>Fri, 28 Oct 2005 13:42:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471837#M39429</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471838#M39430</link>
      <description>You're welcome.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Matt W&lt;BR /&gt;
"Children are like TV sets. When they start acting weird, whack them across &lt;BR /&gt;
the head with a big rubber basketball shoe."&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997487@discussion.autodesk.com...&lt;BR /&gt;
That'll do the job, Many thanks for your help&lt;BR /&gt;
&lt;BR /&gt;
Dom&lt;/DHORTON&gt;</description>
      <pubDate>Fri, 28 Oct 2005 13:50:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471838#M39430</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471839#M39431</link>
      <description>Here is your answer from the VBA helps files, sorry.&lt;BR /&gt;
&lt;BR /&gt;
Note that Is and Like can't be used as comparison operators in a Select Case &lt;BR /&gt;
statement.&lt;BR /&gt;
&lt;BR /&gt;
Joe&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997422@discussion.autodesk.com...&lt;BR /&gt;
I think I can solve in an around-about way using for example,&lt;BR /&gt;
&lt;BR /&gt;
Case "F800" To "G"&lt;BR /&gt;
&lt;BR /&gt;
I'd be interested to know if wild cards can be used.&lt;BR /&gt;
&lt;BR /&gt;
Many thanks&lt;BR /&gt;
Dom&lt;/DHORTON&gt;</description>
      <pubDate>Fri, 28 Oct 2005 13:53:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471839#M39431</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471840#M39432</link>
      <description>Cheers for your help&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Dom</description>
      <pubDate>Fri, 28 Oct 2005 13:59:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471840#M39432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T13:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471841#M39433</link>
      <description>Another possible issue:&lt;BR /&gt;
&lt;BR /&gt;
In your For Each ... loop, when youy set some layers' Freeze to True, you &lt;BR /&gt;
may want to test if the layer is ActiveLayer or not, if it is, you cannot &lt;BR /&gt;
set its Freeze to True (you'll get runtime error). Unless you know before &lt;BR /&gt;
hand that ActiveLayer will not possibaly included, but doing such a test is &lt;BR /&gt;
always a good practice.&lt;BR /&gt;
&lt;BR /&gt;
&lt;DHORTON&gt; wrote in message news:4997339@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm tring to have a dabble with VBA! I'm wanting to create a form with &lt;BR /&gt;
buttons that will change various layer properties. Having a few problems &lt;BR /&gt;
with the Select Case syntax......i'd be extremely helpful if someone could &lt;BR /&gt;
point me in the right direction. (I'm currently getting the error 'Object &lt;BR /&gt;
doesn't support this property or method (Error 438)'). So I believe there's &lt;BR /&gt;
something wrong with my dimensioning?&lt;BR /&gt;
&lt;BR /&gt;
Many thanks,&lt;BR /&gt;
&lt;BR /&gt;
Dom&lt;BR /&gt;
&lt;BR /&gt;
*********************************&lt;BR /&gt;
Private Sub cmdLayerState1_Click()&lt;BR /&gt;
&lt;BR /&gt;
Dim objLayer As AcadLayer&lt;BR /&gt;
&lt;BR /&gt;
For Each objLayer In ThisDrawing.Layers&lt;BR /&gt;
&lt;BR /&gt;
Select Case objLayer&lt;BR /&gt;
Case "layer1*"&lt;BR /&gt;
objLayer.LayerOn = False&lt;BR /&gt;
Case "layer222"&lt;BR /&gt;
objLayer.Plottable = False&lt;BR /&gt;
Case "layer333"&lt;BR /&gt;
objLayer.Freeze = True&lt;BR /&gt;
&lt;BR /&gt;
End Select&lt;BR /&gt;
Next&lt;BR /&gt;
Application.Update&lt;BR /&gt;
End Sub&lt;BR /&gt;
***********************************&lt;/DHORTON&gt;</description>
      <pubDate>Fri, 28 Oct 2005 14:01:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471841#M39433</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T14:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select Case basics!</title>
      <link>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471842#M39434</link>
      <description>Thanks Norman, I'll bear that in mind.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Dom</description>
      <pubDate>Fri, 28 Oct 2005 14:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/select-case-basics/m-p/1471842#M39434</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-28T14:08:07Z</dc:date>
    </item>
  </channel>
</rss>

