passing strings

  • Thread starter Thread starter Sirron
  • Start date Start date
S

Sirron

I'm trying to pass a string value from one module to
another how can you do this?

I have a string that contains a numerI need to pass that
string to another module to do the rest of the code.
 
in one module (module1), declare a public varaible (public myVar) .. in the
other module (module2) state module1.myVar = "blahblahblah"

theHman
 
I've never used a public variable. Shall I say that again? I've never
used a public variable. If I've never needed one, the chances are you
don't them either. Here's a hint: you should think in terms of passing
values between sub procedures (properties and methods - subs and
functions) not modules.

The closest I've come is a public property Get/Let pair in a class
module, which I would call from outside the class as
InstanceName.PropertyName.

When you use a public variable in a class module VBA implicitly makes
it a public property, technically called a 'field' I believe. You can
explicitly declare property Get/Let pairs in standard modules and get
the implicit behaviour of public variables in standard modules too.

And this is the Module1.MyVar syntax you are referring to i.e. the
equivalent of InstanceName.PropertyName.

But properties in a standard module, implicit or otherwise, don't
really make a lot of sense.
 
Back
Top