Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2015, 03:45 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Error in macro "Ambiguous name detected" - but why?? Windows 7 64bit Error in macro "Ambiguous name detected" - but why?? Office 2013
Advanced Beginner
Error in macro "Ambiguous name detected" - but why??
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default Error in macro "Ambiguous name detected" - but why??

Hi,

my issue is pretty simple:
In a macro, I have an error message "Ambiguous name detected".
I have looked up elsewhere what that message means and it's pretty clear, I'm using something that is already taken so to speak. The VBE also highlights the very word that causes the issue ...

<=> but that is a variable?! Aren't variables supposed to be populated and re-populated just as often as you need them to?

Can anybody help me there?

P.S.:
I can of course post the piece of the code where this happens, but it's not quite apparent to me how that would help. Still, if you need to see it, I can provide it.
Shortly speaking, I have a variable v_path1 (which is the term highlighted) which holds the filepath and a variable Dateiname which holds the file_name.
=> Then I have a formula
>> v_path_total = v_path1 & "\" & Dateiname <<
... and then I open the file like
>> Workbooks.Open Filename:=v_path_total, UpdateLinks:=False <<


That is basically all I'm doing.

Thanks a lot!

Best regards,

Officer_Bierschnitt
Reply With Quote
  #2  
Old 11-27-2015, 04:16 AM
macropod's Avatar
macropod macropod is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I'd suggest checking that you haven't declared the variable more than once at any level applicable to your code (i.e. at the procedure-level, module level and/or public module level (check other modules, too)).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-27-2015, 05:30 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2013
Advanced Beginner
Error in macro &quot;Ambiguous name detected&quot; - but why??
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

Hi,

I have a module of its own called "Declarations" where all I do is declare all of the variables needed in any of the other modules. No variables are declared anywhere else - except the ones that I really need in only one procedure, variables that I need throughout one module are declared in that module, too.
I will just try using another variable in the places where that error occurs ... Let's see.

P.S.: Now it's happening with another variable, >> v_path_total << - strangely, the error always occurs upon the first mentioning of the variable in a procedure. Can it be that I must not populate the same variable first with one, then with another value (twice or more altogether) in the same procedure? No, actually not, in a subroutine I use one variable and re-populate it with different values four times in a procedure ...

I have also just restarted my entire machine, sometimes something gets stuck somewhere and that helps ... but it did not in this case.

I'm really at a loss about this. Luckily, I have left the "original" file with the macro intact and I am experimenting on a copy, so it will work on Monday ...
Reply With Quote
  #4  
Old 11-27-2015, 06:07 AM
Debaser's Avatar
Debaser Debaser is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Do you use Option Explicit?

If not, and you use a variable above the line that declares it, you would get a "duplicate declaration" error. "Ambiguous name" errors usually occur because you have duplicated a routine name, not a variable.
Reply With Quote
  #5  
Old 11-27-2015, 06:17 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2013
Advanced Beginner
Error in macro &quot;Ambiguous name detected&quot; - but why??
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

Hmm ... maybe I have it. In addition to the general module "Declarations" that I have, there was one module from which I had copied some code, but which I had not yet removed. There were also some variable_declarations in there, also with PUBLIC, but still, that might have been the issue ...
I just removed it now and it seems to be working.
Reply With Quote
  #6  
Old 11-30-2015, 02:22 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2013
Advanced Beginner
Error in macro &quot;Ambiguous name detected&quot; - but why??
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

Hi macropod,

I assume you applied this "Solved" button to this thread. You're right, I guess that was the problem.
Can I do that myself once I have solved a problem? How?

Best regards,

Officer_Bierschnitt
Reply With Quote
  #7  
Old 11-30-2015, 02:31 AM
macropod's Avatar
macropod macropod is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I may have done, based on your 'it seems to be working' comment.

To mark a thread as solved, select the 'Mark this thread as solved' option from the 'Thread Tools' dropdown.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 11-30-2015, 03:55 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Error in macro &quot;Ambiguous name detected&quot; - but why?? Windows 7 64bit Error in macro &quot;Ambiguous name detected&quot; - but why?? Office 2013
Advanced Beginner
Error in macro &quot;Ambiguous name detected&quot; - but why??
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

Ah, I see. Thank you!
That looks a lot more orderly and it does make it easier for everyone to see at a glance which threads still wait for an answer and which don't. I'll look through my own threads now and mark all those as solved where I have found a solution.
Thanks!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: "Changes made were lost...reconnect with server", when switching "from" field randhurrle Outlook 2 02-25-2015 06:51 PM
remove repeated words with " macro " or " wild cards " in texts with parentheses and commas jocke321 Word VBA 2 12-10-2014 11:27 AM
Error in macro &quot;Ambiguous name detected&quot; - but why?? Setup Error "this language is not supported installing office 2007" Umsotho Office 4 03-19-2014 03:11 PM
Error in macro &quot;Ambiguous name detected&quot; - but why?? How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft