Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Form variable duplication allowed in different forms in personal.xls?

I am getting "ambiguous name detected" error message when try to run
some code that has a form in it. Is it the case that if I have
multiple different forms in my personal.xls (each form is for
different code also within personal.xls) that all variable names have
to be different?

I was thinking that among different forms in the personal.xls that
there could be name duplications as long as I didn't try to use the
two forms that have the duplications in the same code.

Thanks, Chet
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Form variable duplication allowed in different forms in personal.x

"Ambiguious Name Detected" has to do with naming two procedures or functions
the same, or declaring 2 identical variables in the same procedure or global
declarations. Duplicate variable declarations normally generate a "Duplicate
Declaration in Current Scope" error.

'Global declarations in one module or one procedure
Dim x as string
Dim x as long 'Ambiguious Name Detected

'Procedure
sub test(byval x as string)
dim x as string 'Duplicate Declaration in Current Scope
end sub

These examples are fine
Dim x As String 'in module 1
Dim x as String 'In module 2

sub Test() in module 2
dim x as long 'local declaration of x where x is also global
end sub
--
HTH...

Jim Thomlinson


"Chet" wrote:

I am getting "ambiguous name detected" error message when try to run
some code that has a form in it. Is it the case that if I have
multiple different forms in my personal.xls (each form is for
different code also within personal.xls) that all variable names have
to be different?

I was thinking that among different forms in the personal.xls that
there could be name duplications as long as I didn't try to use the
two forms that have the duplications in the same code.

Thanks, Chet

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Form variable duplication allowed in different forms inpersonal.x

On Mar 19, 9:06*am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
"Ambiguious Name Detected" has to do with naming two procedures or functions
the same, or declaring 2 identical variables in the same procedure or global
declarations. Duplicate variable declarations normally generate a "Duplicate
Declaration in Current Scope" error.

'Global declarations in one module or one procedure
Dim x as string
Dim x as long 'Ambiguious Name Detected

'Procedure
sub test(byval x as string)
dim x as string 'Duplicate Declaration in Current Scope
end sub

These examples are fine
Dim x As String 'in module 1
Dim x as String 'In module 2

sub Test() in module 2
dim x as long 'local declaration of x where x is also global
end sub
--
HTH...

Jim Thomlinson



"Chet" wrote:
I am getting "ambiguous name detected" error message when *try to run
some code that has a form in it. *Is it the case that if I have
multiple different forms in my personal.xls (each form is for
different code also within personal.xls) that all variable names have
to be different?


I was thinking that among different forms in the personal.xls that
there could be name duplications as long as I didn't try to use the
two forms that have the duplications in the same code.


Thanks, *Chet- Hide quoted text -


- Show quoted text -


I should simplify my question. Can I have the same variable name in
multiple different "forms" inside my personal.xls?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
corrupted form in Personal Workbook Janis Excel Programming 0 August 30th 06 07:51 PM
Pass variable from form to form to form headly Excel Programming 1 May 31st 06 02:50 AM
Showing Forms using a public variable Adamaths Excel Programming 4 February 15th 06 05:02 PM
Loading a calendar (user form) from another project (personal.xls) Ollie[_2_] Excel Programming 1 September 25th 05 09:33 PM
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"