Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: kadettevo on May 14, 2010, 05:54:18 PM
-
I have a compilation problem in my M6 macro (attached) i have a Select Case statement
in there to select the nexttool to be inserted, and the case activates or deactivates outputs as binary code for
may PLC, but i cant compile it when i have the Select case statement... If i delete it i can, but of course the macro doesn't work :D
So any one out there, WHAT I'm doing wrong????
Or can it be solved in another way??
-
At first glance, the problem does not appear to be the select statement.
1) Format the indenting so you can see what is going on - when you do, you'll notice that there are at least 3 If statements which don't have corresponding "end if"s. Fix that first, then see if the syntax errors clear up.
2) make the first line of the script be "Option explicit" - then declare all the variables you use.
Implicitly declaring variables on the fly will get you in trouble sooner or later - all it takes is one typo.
Dave