loss of variable values between the modules of a project

loss of variable values between the modules of a project

Anonymous
Not applicable
212 Views
1 Reply
Message 1 of 2

loss of variable values between the modules of a project

Anonymous
Not applicable
I use a basic module from where I call three procedures which are in three separate modules. In the first procedure I use 2 variables that I want to use also in the two next procedures. I have declared the two variables as public in the first procedure and in the second procedure everything is ok. But in the next procedure, the third one, theirs value are 0. Why it happens? What am I doing wrong?
0 Likes
213 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Venia,

I assume you are talking about Inventor's VBA not VB6 or VB.Net.

If this is true then you are running up against some of the limitations in VBA. Public Variables in Project .BAS modules are not persistent.

One way around the issue is to use good programming practice and pass your variables as arguments in your procedures instead of trying to use global variables.

If that isn't an option. (Though I would find that hard to believe.) Then you could create an Inventor Add_In dll that shares the same memory space with inventor. Global variables inside the add_in will be retained. (Of course you will be needing VB6 at a minimum to do that)

~T
0 Likes