The declaration
Public myString as String
has to be in a normal module (outside of every proceedure).
It looks it is in a sheet's code module instead of a normal module.