Complete error ambiguous name detected

When compiling some code (declarations shown below) I get the error message 'Compile Error: Ambiguous name detected. SixTables'. I have looked here and elsewhere but cannot find anything that matc...

Having had this issue many times, and not fully understanding why, I think there is an important fact that I have tested, and someone can confirm. It may be obvious to professional programmers, but I place this here for those that seek these answers on discussions, who are usually not professional programmers.

A variable declared within a sub() is not «declared» (memory assigned) until that sub() is executed. And when the execution of that sub() is complete, the memory is released. Until now, I thought Public variables acted in similar way; available to any module that used it, —BUT only existing as long as the module where they were declared was still executing.

However, for any Public variable who’s declaration line is in any module in the workbook, that variable is declared and available at the execution of any module within the workbook, even if the module where the Public declaration exists is never called or executed.

Therefore, if you have a Public variable declaration in one module, and then again in a separate module that you plan to run independent of the first, Excel still sees 2 declarations for the same variable, and thus it is ambiguous.

To prove it, you can create a blank module within a workbook project, and add absolutely nothing except two Public declaration lines,


Public VariableX as String

Public VariableY as Integer


and those variables will be declared and available throughout the project, for any sub() executed. This fact is also probably the reason for the tip about minimizing the use of public variables.

Again, this may have been kindergarten level information for professional programmers, but most on this are not pros, and have to learn these lessons the hard way, or through discussion boards like this. I hope this helps someone.

Содержание

  1. «Ambiguous name detected» error when you run a procedure in Access
  2. Symptoms
  3. Cause
  4. Workaround
  5. Обнаружено неоднозначное имя
  6. Поддержка и обратная связь
  7. Ambiguous name detected
  8. Support and feedback
  9. Ambiguous Name Detected VBA
  10. Variable and Procedure with Same Name
  11. Duplicate Functions or Sub-Procedures
  12. VBA Code Examples Add-in
  13. How to Solve «Ambiguous Name Detected» VBA Error

«Ambiguous name detected» error when you run a procedure in Access

Original KB number: В 817411

Requires basic macro, coding, and interoperability skills.

Symptoms

When you run a procedure in Microsoft Access 2000 or later, you may receive the following error message:

The expression Event_Name you entered as the event property setting produced the following error: Ambiguous name detected: EventProcedure_Name.

Cause

This error occurs when there are multiple procedures with the same name in a module.

Workaround

To work around this problem, delete the unwanted duplicate procedure. To do this, follow these steps:

Open the form in Design view.

In Microsoft Office Access 2003, click Code on the View menu.

In Microsoft Office Access 2007, click View Code in the Tools group on the Design tab.

On the Debug menu, click Compile Database Name.

You receive the following error message:

Compile error: Ambiguous name detected: Procedure Name.

Notice the procedure name, and then click OK.

In the code, find the other occurrences of the Procedure Name procedure, where Procedure Name produced the compile error mentioned in step 3.

Select and then delete the unwanted procedure.

On the Debug menu, click Compile Database Name.

On the File menu, click Close.

Источник

Обнаружено неоднозначное имя

Идентификатор конфликтует с другим идентификатором или требует квалификации. Эта ошибка имеет следующие причины и способы решения:

Элементы с одинаковыми именами могут принадлежать нескольким объектам в одной и той же области видимости.

Квалифицируйте имя элемента, указывая имя объекта и точку. Пример:

Идентификаторы уровня модуля и идентификаторы уровня проекта (имена модуля и имена связанных проектов) могут повторно использоваться в процедуре, хотя это усложняет сопровождение и отладку программы. Но, если нужно сослаться в одной процедуре на оба элемента, необходимо квалифицировать элемент с более широкой областью видимости. Например, если переменная MyID объявлена на уровне модуля MyModule , а затем в модуле на уровне процедуры объявлена переменная с тем же именем, ссылки на переменную уровня модуля должны быть соответствующим образом квалифицированы:

Идентификатор, объявленный на уровне модуля, конфликтует с именем процедуры. Например, эта ошибка возникает, если переменная MyID объявлена на уровне модуля, а затем определена процедура с таким же именем:

В этом случае необходимо изменить можно из имен, так как квалификация с общим именем модуля не разрешит неоднозначность. Имена процедур по умолчанию являются общедоступными (Public), а имена переменных — частными (Private), если они не объявлены как Public.

Для получения дополнительной информации выберите необходимый элемент и нажмите клавишу F1 (для Windows) или HELP (для Macintosh).

Поддержка и обратная связь

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

Источник

Ambiguous name detected

The identifier conflicts with another identifier or requires qualification. This error has the following causes and solutions:

More than one object in the same scope may have elements with the same name.

Qualify the element name by including the object name and a period. For example:

Module-level identifiers and project-level identifiers (module names and referenced project names) may be reused in a procedure, although it makes programs harder to maintain and debug. However, if you want to refer to both items in the same procedure, the item having wider scope must be qualified. For example, if MyID is declared at the module level of MyModule , and then a procedure-level variable is declared with the same name in the module, references to the module-level variable must be appropriately qualified:

An identifier declared at module-level conflicts with a procedure name. For example, this error occurs if the variable MyID is declared at module level, and then a procedure is defined with the same name:

In this case, you must change one of the names because qualification with a common module name would not resolve the ambiguity. Procedure names are Public by default, but variable names are Private unless specified as Public.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Источник

Ambiguous Name Detected VBA

This article will explain the reason that an ambiguous name is detected in VBA.

There are a number of different reasons why this error can occur in VBA. This is usually due to the fact that a variable and a procedure (sub or function) are called the same within the same scope in your code; of you have 2 procedures that have the same name within the same scope.

Variable and Procedure with Same Name

This error also occur if you have a variable and procedure in the same module with the same name.

To resolve the issue, (1) rename either the the variable and then, (2) in the menu, click Debug > Compile VBA Project to make sure your code will compile.

You will know your code is compiled correctly if the compile option is then greyed out.

Duplicate Functions or Sub-Procedures

This error will also occur if you have 2 procedures with the same name in the same module, when you try and compile your code, you will get the compile error – Ambiguous name detected.

Removing one of the procedures or amending the name, and then recompiling the code will once again fix the error.

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

Источник

How to Solve «Ambiguous Name Detected» VBA Error

While working with VBA you may get this error popup when you run the procedure. This error says «Ambiguous name detected: procedure name «. In this article, we will learn why this error occurs and how we can solve it.

Well as the pop up says, VBA engine has detected one or more procedures with the same name in the same module. This has led to confusion for the VBA engine. Hence the VBA reports the error.

How to solve this problem?

It’s easy. Don’t have two same procedures with the same name in a single module. Either change the name of the procedure, delete it or take it to some other module.

This error typically pops up while working with events in Excel.

Let’s say you are working on sheet1 with worksheet events. Now you want to trigger a message as soon as the user changes the cell selection. In that case you will use the Worksheet_SelectionChange() Event .

Now again you want to ask some questions to the users as the user changes the cell selection. Then you will have to use the same event. Now you have written two event handling procedures for different tasks.

Now when you change the selection on the sheet, this is what you get.

Now when you change the selection on the sheet, this is what you get.

See, the thing is that Excel doesn’t allow this. You can’t have two or more same names of functions in a module. Not even in Events. It leads to ambiguity.

Now if you want to do a different task on the same event, then you have to put that code in the same one event procedure. Use conditions to control the events.

The below event will work perfectly fine. When the user changes the cell selection on the sheet1, it will pop up a hi message and after that it will ask the user a question with an input box.

Now that the ambiguity is gone, the event will work perfectly fine and you will not get the error ambiguous name detected error again.

So yeah guys, this is how you can solve the ambiguity error in Excel VBA. I hope this was helpful. If you have any doubts regarding this article or any other article ask me in the comments section below.

Reference Isn’t Valid Excel Error and How to Solve It? : This error occurs when we refer to an object or location that doesn’t exist or have changed. To solve this problem we track down the reference.

The Events in Excel VBA | There are seven types of Events in Excel. Each event deals in a different scope. Application Event deals with workbook level. Workbook on sheet level. Worksheet Event at Range level.

The Worksheet Events in Excel VBA |The worksheet events are really useful when you want your macros run when a specified event occurs on the sheet.

Workbook events using VBA in Microsoft Excel | The workbook events work on the entire workbook. Since all the sheets are part of the workbook, these events work on them too.

Chart object events using VBA in Microsoft Excel | The Charts are complex objects and there are several components that you attached to them. To make the Chart Events we use the Class module.

50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make your work even faster on Excel.

The VLOOKUP Function in Excel | This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

COUNTIF in Excel 2016 | Count values with conditions using this amazing function. You don’t need to filter your data to count specific value. Countif function is essential to prepare your dashboard.

How to Use SUMIF Function in Excel | This is another dashboard essential function. This helps you sum up values on specific conditions.

Источник

Return to VBA Code Examples

This article will explain the reason that an ambiguous name is detected in VBA.

vba ambiguous intro

There are a number of different reasons why this error can occur in VBA. This is usually due to the fact that a variable and a procedure (sub or function) are called the same within the same scope in your code; of you have 2 procedures that have the same name within the same scope.

Variable and Procedure with Same Name

This error also occur if you have a variable and procedure in the same module with the same name.

To resolve the issue, (1) rename either the the variable and then, (2) in the menu, click Debug > Compile VBA Project to make sure your code will compile.

vba ambiguous changevariable

You will know your code is compiled correctly if the compile option is then greyed out.

vba ambiguous compiled

Duplicate Functions or Sub-Procedures

This error will also occur if you have 2 procedures with the same name in the same module, when you try and compile your code, you will get the compile error  – Ambiguous name detected.

vba ambiguous 2 procedures

Removing one of the procedures or amending the name, and then recompiling the code will once again fix the error.

Recently many Excel users have been found reporting that while working with the VBA, they are seeing an error message “Compile error: Ambiguous name detected: Worksheet_SelectionChange”.

The error typically appears when running the procedure and occurs due to some sort of glitches in the VBA engine.

So, if you are struggling with this error, this article is for you. Here we have done our research and shortlisted the potential fixes that work for several affected users to solve the error.

But before starting with the solutions, let’s have a look at the common culprit causing the error.

What Causes Ambiguous Name Detected VBA Error?

The error usually appears when the VBA engine detects more than one procedure with a similar name in the similar module, which causes confusion to the VBA engine. As a result, the VBA starts reporting an error message.

Despite this, if you have 2 procedures with the same name within the same scope, it starts causing issues.

Now, follow the fixes to solve the ambiguous name detected in the VBA error.

How to Fix “Ambiguous Name Detected” VBA Error?

To fix the error, you need to make sure not to have the same procedures including the same name in one module. In this case, you need to either change the procedure name and delete it or send it to another module.

Solution 1 – Rename the Variable

As said above, the problem is related to the same name in the module, so in this case, renaming the variable may work for you to solve the problem.

First, you need to the variable, and next go to the menu here, click on Debug, and then on Compile VBA project allows your code to compile.

Now check if the Ambiguous Name Detected VBA Error is resolved or not.

Solution 2 – Change the Sheet selection

Well, the error usually appears at the time of working with the events in Excel.

So, let’s assume if you are working with worksheet events on sheet1, then you require a message when the user modifies the cell selection, and in this case, you can utilize the Worksheet_SelectionChange() Event.

Here again, you require asking some questions to the user as he changes the call selection. In this case, you need to utilize the same event and as you have written two event handling events for different tasks.

 MsgBox "Hi"
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 Application.InputBox ("who are you?")
End Sub

And as you modify sheet selection, you will see a message, as shown in the image:

Ambiguous Name Detected VBA Error

Here the point is that Excel won’t allow this; one cannot have more than one same function name in the module as well as in the Events. Doing this will cause ambiguity.

And if you need to do a different tasks on the same events, then, in this case, you need to put that code in the same event procedure.  You can use conditions for controlling the events.

Here the below-given event will work fine at the time user changes cell selection in sheet1, and it shows the hi message and next it asks the user a question with an input box.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 MsgBox "Hi"
 Application.InputBox ("who are you?")
End Sub

As you can see, now the ambiguity is cleared; the event will now start working fine, and you won’t see the ambiguous name detected error anymore.

Recommended Way to Repair Corrupted Excel Workbook

If, meanwhile, while performing the task or fixing Excel errors, unfortunately, you lose your Excel data, then you can use Excel Repair Tool.

This professional tool can easily repair and recover corrupted, damaged, or inaccessible Excel files. This unique tool is used to repair multiple excel files in one repair cycle and recover the entire data in the preferred location.

* Free version of the product only previews recoverable data.

It can fix Excel file corruption issues and various errors frequently encountered by users. It allows us to easily restore entire data, including charts, worksheet properties, cell comments, and other data. You can try this tool’s free demo version.

Steps to Utilize Excel File Recovery Tool:

Conclusion

So, this is all about the ambiguous name detected worksheet_selectionchange error in  Excel

Make sure to follow the steps given carefully and solve the error.

I hope the article is helpful for you. If you are facing any other issue related to this specific one, let us know by sharing your experience on our social media FB and Twitter Pages.

Priyanka is an entrepreneur & content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.

While working with VBA you may get this error popup when you run the procedure. This error says «Ambiguous name detected: procedure name«. In this article, we will learn why this error occurs and how we can solve it.

Why this error?

Well as the pop up says, VBA engine has detected one or more procedures with the same name in the same module. This has led to confusion for the VBA engine. Hence the VBA reports the error.

How to solve this problem?

It’s easy. Don’t have two same procedures with the same name in a single module. Either change the name of the procedure, delete it or take it to some other module.

This error typically pops up while working with events in Excel.

Let’s say you are working on sheet1 with worksheet events. Now you want to trigger a message as soon as the user changes the cell selection. In that case you will use the Worksheet_SelectionChange() Event.

Now again you want to ask some questions to the users as the user changes the cell selection. Then you will have to use the same event. Now you have written two event handling procedures for different tasks.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 MsgBox "Hi"
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 Application.InputBox ("who are you?")
End Sub

Now when you change the selection on the sheet, this is what you get.

Now when you change the selection on the sheet, this is what you get.

See, the thing is that Excel doesn’t allow this. You can’t have two or more same names of functions in a module. Not even in Events. It leads to ambiguity.

Now if you want to do a different task on the same event, then you have to put that code in the same one event procedure. Use conditions to control the events.

The below event will work perfectly fine. When the user changes the cell selection on the sheet1, it will pop up a hi message and after that it will ask the user a question with an input box.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 MsgBox "Hi"
 Application.InputBox ("who are you?")
End Sub

Now that the ambiguity is gone, the event will work perfectly fine and you will not get the error ambiguous name detected error again.

So yeah guys, this is how you can solve the ambiguity error in Excel VBA. I hope this was helpful. If you have any doubts regarding this article or any other article ask me in the comments section below.

Related Articles:

Reference Isn’t Valid Excel Error and How to Solve It? : This error occurs when we refer to an object or location that doesn’t exist or have changed. To solve this problem we track down the reference.

The Events in Excel VBA | There are seven types of Events in Excel. Each event deals in a different scope. Application Event deals with workbook level. Workbook on sheet level. Worksheet Event at Range level.

The Worksheet Events in Excel VBA |The worksheet events are really useful when you want your macros run when a specified event occurs on the sheet.

Workbook events using VBA in Microsoft Excel | The workbook events work on the entire workbook. Since all the sheets are part of the workbook, these events work on them too.

Prevent an auto macro/event macro executes using VBA in Microsoft Excel | To prevent the run of auto_open macro use the shift key.

Chart object events using VBA in Microsoft Excel | The Charts are complex objects and there are several components that you attached to them. To make the Chart Events we use the Class module.

Popular Articles:

50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make your work even faster on Excel.

The VLOOKUP Function in Excel | This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

COUNTIF in Excel 2016 | Count values with conditions using this amazing function. You don’t need to filter your data to count specific value. Countif function is essential to prepare your dashboard.

How to Use SUMIF Function in Excel | This is another dashboard essential function. This helps you sum up values on specific conditions.

Содержание

  1. Обнаружено неоднозначное имя
  2. Поддержка и обратная связь
  3. Ambiguous name detected: TmpDDE error in Word
  4. phbrsunshine (remove this)
  5. Advertisements
  6. Beth Melton
  7. Ambiguous name detected tmpdde что за ошибка
  8. Вопрос
  9. Ответы
  10. Все ответы
  11. Ambiguous name detected tmpdde что за ошибка
  12. Answered by:
  13. Question
  14. Answers
  15. All replies
  16. Ambiguous name detected
  17. Support and feedback

Обнаружено неоднозначное имя

Идентификатор конфликтует с другим идентификатором или требует квалификации. Эта ошибка имеет следующие причины и способы решения:

Элементы с одинаковыми именами могут принадлежать нескольким объектам в одной и той же области видимости.

Квалифицируйте имя элемента, указывая имя объекта и точку. Пример:

Идентификаторы уровня модуля и идентификаторы уровня проекта (имена модуля и имена связанных проектов) могут повторно использоваться в процедуре, хотя это усложняет сопровождение и отладку программы. Но, если нужно сослаться в одной процедуре на оба элемента, необходимо квалифицировать элемент с более широкой областью видимости. Например, если переменная MyID объявлена на уровне модуля MyModule , а затем в модуле на уровне процедуры объявлена переменная с тем же именем, ссылки на переменную уровня модуля должны быть соответствующим образом квалифицированы:

Идентификатор, объявленный на уровне модуля, конфликтует с именем процедуры. Например, эта ошибка возникает, если переменная MyID объявлена на уровне модуля, а затем определена процедура с таким же именем:

В этом случае необходимо изменить можно из имен, так как квалификация с общим именем модуля не разрешит неоднозначность. Имена процедур по умолчанию являются общедоступными (Public), а имена переменных — частными (Private), если они не объявлены как Public.

Для получения дополнительной информации выберите необходимый элемент и нажмите клавишу F1 (для Windows) или HELP (для Macintosh).

Поддержка и обратная связь

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

Источник

Ambiguous name detected: TmpDDE error in Word

phbrsunshine (remove this)

I am trying to print word document from a folder using
the tasks and toolbars menu or «right clicking» the
selected documents. this has been working fine. Now I
am getting a Visual basic error that says «Ambiguous name
detected: TmpDDE, and must open each document to print
it. Please help me, the folks at Dell tell me that it is
impossible to print without opening the documents.

Thank you,
Shannon

Advertisements

Beth Melton

When you use the short cut menu to print a document a macro is
temporarily created in Word. This macro is stored in your Normal.dot.
This macro should be deleted but if you encountered an error and Word
was unable to delete the temporary macro then the next time you
attempt to print a macro with a duplicate name is encountered.

To resolve the issue you will need to start Word and go to
Tools/Macro/Macros and delete the TmpDDE macro.

If you are unable to resolve the problem then you can always create a
new Normal.dot. Locate Normal.dot and rename it to OldNormal.dot. Word
will create a new one upon starting.

If this resolves the problem, any customizations can be copied to the
new Normal.dot via the Organizer (Tools/Templates and Add-Ins) Once
this is complete OldNormal.dot can be discarded. If the problem still
exists then you can delete the new Normal.dot and rename your
OldNormal.dot to Normal.dot.


Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

Beth Melton
Microsoft Office MVP

Источник

Ambiguous name detected tmpdde что за ошибка

Вопрос

I have a user that can read documents from the document library but when he goes to checkout the file and open in Word, he gets a «ambiguous name detected:TmpDDe» Everything I have read about this says to delete the TmpDDE macro in Word but that does not help. I don’t know if it is SP or the Office Suite. Anyone with any advice.

Ответы

Any way the user in question could try loggin in on another machine and performing the same action? Chris Caravajal: SharePoint Help

  • Помечено в качестве ответа Xue-Mei Chang-MSFT Moderator 20 марта 2009 г. 1:47

Все ответы

Any way the user in question could try loggin in on another machine and performing the same action? Chris Caravajal: SharePoint Help

  • Помечено в качестве ответа Xue-Mei Chang-MSFT Moderator 20 марта 2009 г. 1:47

the same thing happens to me. The way I get around it, is I right-click and save target as . still haven’t resolved the problem yet.

This worked for me:

deleted normal.dot in (actually renamed to normal.dot.bad) and closed all programs that might use it (outlook)

C:Documents and Settings userid Application DataMicrosoftTemplates

and replaced with a good version from company templates.

I found this blog post, and the resolution worked for my users. It looks like the Normal.dot/Normal.dotm file is corrupted, so it needs to be re-created in the users AppData folder.

On a Windows 7 device the resolution would be:

Resolution:
Close all word documents.
Browse to: C:Users AppDataRoamingMicrosoftTemplates
Rename the Normal template file to anything you wish.
Open a blank word document and close it.
Check the C:Users AppDataRoamingMicrosoftTemplates location again.
The Normal file will have been re-created.
Attempt to open a word document from the SharePoint site

Источник

Ambiguous name detected tmpdde что за ошибка

This forum is closed. Thank you for your contributions.

Answered by:

Question

I have a user that can read documents from the document library but when he goes to checkout the file and open in Word, he gets a «ambiguous name detected:TmpDDe» Everything I have read about this says to delete the TmpDDE macro in Word but that does not help. I don’t know if it is SP or the Office Suite. Anyone with any advice.

Answers

Any way the user in question could try loggin in on another machine and performing the same action? Chris Caravajal: SharePoint Help

  • Marked as answer by Xue-Mei Chang-MSFT Moderator Friday, March 20, 2009 1:47 AM

Any way the user in question could try loggin in on another machine and performing the same action? Chris Caravajal: SharePoint Help

  • Marked as answer by Xue-Mei Chang-MSFT Moderator Friday, March 20, 2009 1:47 AM

the same thing happens to me. The way I get around it, is I right-click and save target as . still haven’t resolved the problem yet.

This worked for me:

deleted normal.dot in (actually renamed to normal.dot.bad) and closed all programs that might use it (outlook)

C:Documents and Settings userid Application DataMicrosoftTemplates

and replaced with a good version from company templates.

I found this blog post, and the resolution worked for my users. It looks like the Normal.dot/Normal.dotm file is corrupted, so it needs to be re-created in the users AppData folder.

On a Windows 7 device the resolution would be:

Resolution:
Close all word documents.
Browse to: C:Users AppDataRoamingMicrosoftTemplates
Rename the Normal template file to anything you wish.
Open a blank word document and close it.
Check the C:Users AppDataRoamingMicrosoftTemplates location again.
The Normal file will have been re-created.
Attempt to open a word document from the SharePoint site

Источник

Ambiguous name detected

The identifier conflicts with another identifier or requires qualification. This error has the following causes and solutions:

More than one object in the same scope may have elements with the same name.

Qualify the element name by including the object name and a period. For example:

Module-level identifiers and project-level identifiers (module names and referenced project names) may be reused in a procedure, although it makes programs harder to maintain and debug. However, if you want to refer to both items in the same procedure, the item having wider scope must be qualified. For example, if MyID is declared at the module level of MyModule , and then a procedure-level variable is declared with the same name in the module, references to the module-level variable must be appropriately qualified:

An identifier declared at module-level conflicts with a procedure name. For example, this error occurs if the variable MyID is declared at module level, and then a procedure is defined with the same name:

In this case, you must change one of the names because qualification with a common module name would not resolve the ambiguity. Procedure names are Public by default, but variable names are Private unless specified as Public.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Источник

Permalink

Cannot retrieve contributors at this time

title keywords f1_keywords ms.prod ms.assetid ms.date ms.localizationpriority

Ambiguous name detected

vblr6.chm1032812

vblr6.chm1032812

office

e2bebd51-75cc-99f6-9dcf-81c9bd34e897

06/08/2017

high

The identifier conflicts with another identifier or requires qualification. This error has the following causes and solutions:

  • More than one object in the same scope may have elements with the same name.

    Qualify the element name by including the object name and a period. For example:

    object.property

    Module-level identifiers and project-level identifiers (module names and referenced project names) may be reused in a procedure, although it makes programs harder to maintain and debug. However, if you want to refer to both items in the same procedure, the item having wider scope must be qualified. For example, if MyID is declared at the module level of MyModule, and then a procedure-level variable is declared with the same name in the module, references to the module-level variable must be appropriately qualified:

      Dim MyID As String 
      Sub MySub 
      MyModule.MyID = "This is module-level variable" 
      Dim MyID As String 
      MyID = "This is the procedure-level variable" 
      Debug.Print MyID 
      Debug.Print MyModule.MyID 
      End Sub
  • An identifier declared at module-level conflicts with a procedure name. For example, this error occurs if the variable MyID is declared at module level, and then a procedure is defined with the same name:

      Public MyID 
      Sub MyID 
      '. . . 
      End Sub 

    In this case, you must change one of the names because qualification with a common module name would not resolve the ambiguity. Procedure names are Public by default, but variable names are Private unless specified as Public.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

[!includeSupport and feedback]

Понравилась статья? Поделить с друзьями:
  • Compiler error cs1106
  • Compiler error cs1061
  • Compiler error cs1012
  • Compiler error cs0501
  • Compiler error cs0433