Static integer
Hi,
I'd like to use a static integer for counting up images and to run some macro procedures just on the first image in a batch process.
I don't really want to use the "before" macro, since there will be several decisional vars for the whole thing later in the run during these first user queries.
I used to solve it in this way:
public module X
'global var
dim imcounter% '(static imcounter not possible at this place?)
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
public sub a
static imcounter as integer
imcounter = 1
call sub b
end sub' a
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sub b
select case imcounter
case 1
'do something
else
'don't
end select
end sub 'b
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
end module 'x
However, now the value is not passed to sub b (it's 0)
I tried redim static imcounter% but logic is not accepted.
How to solve?
Is there an internal counter for images during a batch process? (which would be more elegant, probably)
Many thanks
Dan
Best Answer
-
Hello Dan,
You just have to move the declaration out of sub a and use Dim instead of static.
Dim imcounter as integer
Pierre0
Answers