Can I have the same variable names in multiple different "forms"inside my personal.xls?

C

Chet

Can I have the same variable names in multiple different "forms"
inside my personal.xls? In other words in form1 I have a variable
called SaveToDesktop adn in form2 I also have a variable called
SaveToDesktop.

Is this OK to have the same variable name in two different user forms
in the same personal.xls file? This "variable" represents a control
in each form.

Thanks,
Chet
 
C

Chip Pearson

Yes, it is perfectly legal to have variables with the same name in more than
one form or other type of object module.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
C

Chet

Yes, it is perfectly legal to have variables with the same name in more than
one form or other type of object module.

--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
    Excel Product Group
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)








- Show quoted text -

Thank you Chip... I will investigate further. I am getting an
"ambigbuous name detected" message and thought that might be the
name. Oddly though when I did make the variable names different in
each form code section the ambiguous name error message did not occur.
 
C

Chip Pearson

I was referring to having variables with the same name in *object modules*
(Class modules, ThisWorkbook, the Sheet modules, Userforms), not duplicating
names in standard modules. I would strongly recommend that you *not* have
duplicate names in standard modules unless those variables are declared
Private to the module.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



Yes, it is perfectly legal to have variables with the same name in more
than
one form or other type of object module.

--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)








- Show quoted text -

Thank you Chip... I will investigate further. I am getting an
"ambigbuous name detected" message and thought that might be the
name. Oddly though when I did make the variable names different in
each form code section the ambiguous name error message did not occur.
 

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

Top