11-24-2023, 03:02 PM
(This post was last modified: 11-24-2023, 03:02 PM by TerryRitchie.)
(11-24-2023, 08:34 AM)PhilOfPerth Wrote: I'm using it to share variables between the Main and Subroutines, as I often have done - I thought that was the main purpose of this. Wrong again?Use DIM SHARED instead, that will make all your variables global by being shared everywhere.
If you just want to share a variable with a subroutine/function then you can do this:
DIM Test%
SUB MySub()
SHARED Test%
... your code here
END SUB
Test% will be local to the main code and SHARED with the MySub() subroutine.
I have a complete explanation of this in Lesson 6 here in the tutorial.