cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Logical macro syntax

hlafkir
14-Alexandrite

Logical macro syntax

I have this code, that work well :

SubMacro checkColors Protected
Define i As Integer
Define ColorName As String
Define Pattern As String

For i = 1 to activeDoc.colorCount
ColorName = activeDoc.colors[i].name
Pattern = Mid(ColorName, Find(ColorName, "(", 1) + 1, 3)

If (Pattern <> "co=") Then
Select None
Select If Color Is Equal To ColorName

If (activeDoc.selectedElements = 0) Then

Else
Return ColorName
End If
End If
End For

Return "COLORS_OK"
End SubMacro

but if I replace the red colored code by this :

If (activeDoc.selectedElements <> 0) Then
Return ColorName
End If

It no works more.

Is it possible to know why ? for me that make no sense.

Thank you for any help.


3 REPLIES 3
TimPhelps
12-Amethyst
(To:hlafkir)

Is using "<>" legal for numbers?

I presume that it is working for strings.

Does using ">" or "!=" work?

TimSharp
12-Amethyst
(To:TimPhelps)

Just checked my macros - I've used <> for numbers OK, so it can't be that. I haven't used the Return function though so it might be the way that works?

Try changing the use of return, as Tim said, with 'message'.

Announcements

Top Tags