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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Logical macro syntax

hlafkir
13-Aquamarine

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

Is using "<>" legal for numbers?

I presume that it is working for strings.

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

TimSharp
6-Contributor
(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