PC Review


Reply
Thread Tools Rate Thread

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

 
 
Chet
Guest
Posts: n/a
 
      19th Mar 2008
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
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      19th Mar 2008
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)



"Chet" <(E-Mail Removed)> wrote in message
news:648f8eee-dd15-4c47-b650-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Chet
Guest
Posts: n/a
 
      19th Mar 2008
On Mar 19, 11:57*am, "Chip Pearson" <c...@cpearson.com> wrote:
> 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)
>
> "Chet" <chetshan...@gmail.com> wrote in message
>
> news:648f8eee-dd15-4c47-b650-(E-Mail Removed)...
>
>
>
> > 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- Hide quoted text -

>
> - 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.
 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      21st Mar 2008
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)



"Chet" <(E-Mail Removed)> wrote in message
news:45536d2f-5e12-4e95-9b53-(E-Mail Removed)...
On Mar 19, 11:57 am, "Chip Pearson" <c...@cpearson.com> wrote:
> 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)
>
> "Chet" <chetshan...@gmail.com> wrote in message
>
> news:648f8eee-dd15-4c47-b650-(E-Mail Removed)...
>
>
>
> > 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- Hide quoted text -

>
> - 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
Adding custom control to "personal-names" catagory in toolbox esakal Microsoft Dot NET 1 7th Sep 2006 03:13 PM
How do I delete a "FORM" from my "Personal Forms Library"? =?Utf-8?B?TEVF?= Microsoft Access Forms 3 15th Nov 2005 03:43 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Microsoft Excel Worksheet Functions 1 9th Jul 2005 03:05 AM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Microsoft Excel Discussion 1 9th Jul 2005 01:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:35 PM.