Whats happening to my public variable?

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi NG

Major problem and source of confusion for my part!

I have a module, lets call it "modA" that has a public string variable

modA {
public str as string

sub startup()
str = "Hello World"
end sub
}

Okey: Now i try to execute some line of code somewhere in my project:

msgbox modA.str

The first time, the message box will pop up with "Hello World" written in
it. The next time i execute the line, the message box will appear with an
empty string "". What is going on!! I do not get it.

Any help is greatly appreciated.
Mark
 
Mark,

Not sure this is the case, but I suspect "str" is a reserved keyword for
VBA. Try to use another variable name (e.g. str1) instead, and see if this
corrects your problem.

HTH,
Nikos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top