<?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: If..Then..Else returns a false True in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313981#M58740</link>
    <description>I don't know about the kCurve vs kTangent test giving false positive, but it&lt;BR /&gt;
looks like arc is a class?&lt;BR /&gt;
with a property .CCWFlag ?&lt;BR /&gt;
if that's the case, since it's dimmed, I believe the first reference to it&lt;BR /&gt;
creates an instance(virtually setting it) and if the default value for the&lt;BR /&gt;
.CCWFlag is = True then it would evaluate to True even though you didn't&lt;BR /&gt;
specifically set it to a value.&lt;BR /&gt;
&lt;BR /&gt;
not seeing any code it's just guessing in the dark&lt;BR /&gt;
and not being a guru, it's really WILD guessing!&lt;BR /&gt;
:-)~&lt;BR /&gt;
the other thought is have you looked at Select case?&lt;BR /&gt;
multiple levels of if statements are notoriously problematic it seems&lt;BR /&gt;
&lt;BR /&gt;
I know none of that answers your questions but it gets pretty quiet around&lt;BR /&gt;
here on the weekends sometimes so maybe something is better than nothing?&lt;BR /&gt;
good luck&lt;BR /&gt;
and go easy on that forehead&lt;BR /&gt;
Mark&lt;BR /&gt;
&lt;BR /&gt;
"Jeff Mishler" &lt;MIFF&gt; wrote in message&lt;BR /&gt;
news:7C4C4694C137C5ABF703859955E1962F@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I have not run into this before and I've banged my head on my desk enough&lt;BR /&gt;
&amp;gt; today so I must ask the vba guru's out there: "How can this happen?"&lt;/MIFF&gt;</description>
    <pubDate>Fri, 05 Dec 2003 17:18:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-12-05T17:18:49Z</dc:date>
    <item>
      <title>If..Then..Else returns a false True</title>
      <link>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313979#M58738</link>
      <description>I have not run into this before and I've banged my head on my desk enough&lt;BR /&gt;
today so I must ask the vba guru's out there: "How can this happen?"&lt;BR /&gt;
I can step through my macro and it all works as intended EXCEPT for the&lt;BR /&gt;
following portion of code tha fails at the same place everytime....well, it&lt;BR /&gt;
doesn't fail but it does enter an If function as if it evaluated to true&lt;BR /&gt;
when I KNOW that it is not true, since the conditions have not been met, as&lt;BR /&gt;
shown in the Locals window.&lt;BR /&gt;
&lt;BR /&gt;
tan, entNext and ent are both set and valid, arc is dimmed but not set&lt;BR /&gt;
&lt;BR /&gt;
at this point in the code it correctly evaluates 1* as false, goes to 2*&lt;BR /&gt;
which correctly evaluates true, goes to 3* and this incorrectly evaluates as&lt;BR /&gt;
true, even though the first test is should be false since ent.type evaluates&lt;BR /&gt;
to kTangent and then the second test should fail anyway since arc has not&lt;BR /&gt;
yet been set. By all rights, it should get all the way to 4* before the If&lt;BR /&gt;
evaluates to True.&lt;BR /&gt;
Any ideas as to why this happens?&lt;BR /&gt;
&lt;BR /&gt;
        1*  If entNext.Type = kCurve And entNext.CCWFlag = True Then&lt;BR /&gt;
                If ent.Type = kCurve And arc.CCWFlag = True Then&lt;BR /&gt;
                    aData(X - 1, 1) = "PCC"&lt;BR /&gt;
                ElseIf ent.Type = kCurve And arc.CCWFlag = False Then&lt;BR /&gt;
                    aData(X - 1, 1) = "PRC"&lt;BR /&gt;
                End If&lt;BR /&gt;
      2*    ElseIf entNext.Type = kCurve And entNext.CCWFlag = False Then&lt;BR /&gt;
       3*       If ent.Type = kCurve And arc.CCWFlag = True Then&lt;BR /&gt;
                    aData(X - 1, 1) = "PRC"&lt;BR /&gt;
                ElseIf ent.Type = kCurve And arc.CCWFlag = False Then&lt;BR /&gt;
                    aData(X - 1, 1) = "PCC"&lt;BR /&gt;
                End If&lt;BR /&gt;
       4*   ElseIf entNext.Type = kCurve And ent.Type = kTangent Then&lt;BR /&gt;
                aData(X - 1, 1) = "PC"&lt;BR /&gt;
            ElseIf entNext.Type = kTangent Then&lt;BR /&gt;
                If ent.Type = kCurve Then&lt;BR /&gt;
                    aData(X - 1, 1) = "PT"&lt;BR /&gt;
                ElseIf ent.Type = kTangent Then&lt;BR /&gt;
                    aData(X - 1, 1) = "PI"&lt;BR /&gt;
                End If&lt;BR /&gt;
            End If&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Jeff Mishler&lt;BR /&gt;
remove USES from email address to reply</description>
      <pubDate>Fri, 05 Dec 2003 16:36:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313979#M58738</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-05T16:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: If..Then..Else returns a false True</title>
      <link>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313980#M58739</link>
      <description>Jeff Mishler wrote:&lt;BR /&gt;
&amp;gt; I have not run into this before and I've banged my head on my desk&lt;BR /&gt;
&amp;gt; enough today so I must ask the vba guru's out there: "How can this&lt;BR /&gt;
&amp;gt; happen?"&lt;BR /&gt;
&lt;BR /&gt;
That's a serious mess of spaghetti you have there. Your code would be a&lt;BR /&gt;
lot easier to maintain and read if you used a Select Case instead.&lt;BR /&gt;
&lt;BR /&gt;
I also urge you to abandon all those compound tests. Unlike other&lt;BR /&gt;
languages, all tests will be evaluated from left to right regardless of&lt;BR /&gt;
the number of tests that fail prior to the last one. This makes tracking&lt;BR /&gt;
bugs difficult at best.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
There are 10 kinds of people. Those who understand binary and those who&lt;BR /&gt;
don't.&lt;BR /&gt;
&lt;BR /&gt;
http://code.acadx.com&lt;BR /&gt;
(Pull the pin to reply)</description>
      <pubDate>Fri, 05 Dec 2003 17:05:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313980#M58739</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-05T17:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: If..Then..Else returns a false True</title>
      <link>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313981#M58740</link>
      <description>I don't know about the kCurve vs kTangent test giving false positive, but it&lt;BR /&gt;
looks like arc is a class?&lt;BR /&gt;
with a property .CCWFlag ?&lt;BR /&gt;
if that's the case, since it's dimmed, I believe the first reference to it&lt;BR /&gt;
creates an instance(virtually setting it) and if the default value for the&lt;BR /&gt;
.CCWFlag is = True then it would evaluate to True even though you didn't&lt;BR /&gt;
specifically set it to a value.&lt;BR /&gt;
&lt;BR /&gt;
not seeing any code it's just guessing in the dark&lt;BR /&gt;
and not being a guru, it's really WILD guessing!&lt;BR /&gt;
:-)~&lt;BR /&gt;
the other thought is have you looked at Select case?&lt;BR /&gt;
multiple levels of if statements are notoriously problematic it seems&lt;BR /&gt;
&lt;BR /&gt;
I know none of that answers your questions but it gets pretty quiet around&lt;BR /&gt;
here on the weekends sometimes so maybe something is better than nothing?&lt;BR /&gt;
good luck&lt;BR /&gt;
and go easy on that forehead&lt;BR /&gt;
Mark&lt;BR /&gt;
&lt;BR /&gt;
"Jeff Mishler" &lt;MIFF&gt; wrote in message&lt;BR /&gt;
news:7C4C4694C137C5ABF703859955E1962F@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I have not run into this before and I've banged my head on my desk enough&lt;BR /&gt;
&amp;gt; today so I must ask the vba guru's out there: "How can this happen?"&lt;/MIFF&gt;</description>
      <pubDate>Fri, 05 Dec 2003 17:18:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313981#M58740</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-05T17:18:49Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313982#M58741</link>
      <description>Mark &amp;amp; Frank,&lt;BR /&gt;
Thanks for responding. As it turns out, after I posted my question I decided&lt;BR /&gt;
to try what both of you suggested. Using Select Case made it work and looks&lt;BR /&gt;
alot better. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I had originally thought the the If-Then-Else's would be just a couple quick&lt;BR /&gt;
tests, but they quickly grew out of control as you saw.&lt;BR /&gt;
&lt;BR /&gt;
As you can tell from my "spaghetti", I'm a real HACK at this VBA stuff and&lt;BR /&gt;
all suggestions and contructive criticisms are welcome.&lt;BR /&gt;
&lt;BR /&gt;
BTW, Mark, the arc is just a dimmed AeccAlignmentEntity and the .CCWFlag is&lt;BR /&gt;
a property that only exists if that entity is of the type kCurve.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Jeff&lt;BR /&gt;
&lt;BR /&gt;
"Mark Propst" &lt;NOTMARK-AT-ATRENG-DOT-COM&gt; wrote in message&lt;BR /&gt;
news:26A0559A62BDC475774DA6B0921EBB9E@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I don't know about the kCurve vs kTangent test giving false positive, but&lt;BR /&gt;
it&lt;BR /&gt;
&amp;gt; looks like arc is a class?&lt;BR /&gt;
&amp;gt; with a property .CCWFlag ?&lt;BR /&gt;
&amp;gt; if that's the case, since it's dimmed, I believe the first reference to it&lt;BR /&gt;
&amp;gt; creates an instance(virtually setting it) and if the default value for the&lt;BR /&gt;
&amp;gt; .CCWFlag is = True then it would evaluate to True even though you didn't&lt;BR /&gt;
&amp;gt; specifically set it to a value.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; not seeing any code it's just guessing in the dark&lt;BR /&gt;
&amp;gt; and not being a guru, it's really WILD guessing!&lt;BR /&gt;
&amp;gt; :-)~&lt;BR /&gt;
&amp;gt; the other thought is have you looked at Select case?&lt;BR /&gt;
&amp;gt; multiple levels of if statements are notoriously problematic it seems&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I know none of that answers your questions but it gets pretty quiet around&lt;BR /&gt;
&amp;gt; here on the weekends sometimes so maybe something is better than nothing?&lt;BR /&gt;
&amp;gt; good luck&lt;BR /&gt;
&amp;gt; and go easy on that forehead&lt;BR /&gt;
&amp;gt; Mark&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Jeff Mishler" &lt;MIFF&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:7C4C4694C137C5ABF703859955E1962F@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I have not run into this before and I've banged my head on my desk&lt;BR /&gt;
enough&lt;BR /&gt;
&amp;gt; &amp;gt; today so I must ask the vba guru's out there: "How can this happen?"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/MIFF&gt;&lt;/NOTMARK-AT-ATRENG-DOT-COM&gt;</description>
      <pubDate>Fri, 05 Dec 2003 18:04:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313982#M58741</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-05T18:04:24Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313983#M58742</link>
      <description>like I said *WILD* guess!&lt;BR /&gt;
:-)~&lt;BR /&gt;
glad ya got it working&lt;BR /&gt;
&lt;BR /&gt;
"Jeff Mishler" &lt;MIFF&gt; wrote in message&lt;BR /&gt;
news:DB55E7C0A8C2194AA0AC9FB59CC73B80@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; BTW, Mark, the arc is just a dimmed AeccAlignmentEntity and the .CCWFlag&lt;BR /&gt;
is&lt;BR /&gt;
&amp;gt; a property that only exists if that entity is of the type kCurve.&lt;/MIFF&gt;</description>
      <pubDate>Fri, 05 Dec 2003 19:08:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/if-then-else-returns-a-false-true/m-p/313983#M58742</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-12-05T19:08:09Z</dc:date>
    </item>
  </channel>
</rss>

