Form variable duplication allowed in different forms in personal.xls?

C

Chet

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
 
J

Jim Thomlinson

"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
 
C

Chet

"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







- Show quoted text -

I should simplify my question. Can I have the same variable name in
multiple different "forms" inside my personal.xls?
 

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