Simple string comparison not working

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
jculp
Newbie
Posts: 14
Joined: Wed Aug 06, 2008 5:40 pm

Simple string comparison not working

Post by jculp » Mon Aug 18, 2008 4:08 pm

There must be something I'm missing about comparing strings. Why doesn't this code work right?
******
Poster's edit: NEVER MIND: Too many VBA habits, too hard to see simple prompts (lack thereof)

IF>

Code: Select all

Let>v1=13591P003
Let>v2=26113P001
If v1=v2
   messagemodal>same
Else
   messagemodal>different
Endif



User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Aug 18, 2008 4:21 pm

The correct syntax for the If command is:

If>v1=v2

So your code should be:

Code: Select all

Let>v1=13591P003
Let>v2=26113P001
If>v1=v2
   messagemodal>same
Else
   messagemodal>different
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

jculp
Newbie
Posts: 14
Joined: Wed Aug 06, 2008 5:40 pm

string comparison

Post by jculp » Mon Aug 18, 2008 4:23 pm

Thanks, Marcus. I had just gone back to fundamentals , and used the command reference to insert the If statement and realized what was missing.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts