Variable that is a Variable

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Jlomers
Newbie
Posts: 7
Joined: Tue Feb 06, 2018 4:11 pm

Variable that is a Variable

Post by Jlomers » Tue Oct 16, 2018 8:26 pm

I am not sure how to best describe this but my system pulls the middle initial from excel and is to type that initial into another program. However, when the initial is also a variable the system send the second variable rather than the initial.

Example: John Y Smith

XLGetCell>File,Sheet1,k,9,Init
Elsewhere in the system Y=0

When
"Send>%Init%" is used its send 0 instead of Y

It works if the initial is A C D because those are not variables, but Y or K don't because they are.

I thought the %Init% would prevent this?

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

Re: Variable that is a Variable

Post by Marcus Tettmar » Wed Oct 17, 2018 8:46 am

I think the simplest solution is to use a different variable naming system. So e.g. instead of using Y as a loop counter (or whatever it is being used for) use something like varY. Maybe it's a position, so use posY or something like that. You're much less likely to get a clash that way.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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