Microsoft KB Archive/282145

From BetaArchive Wiki
Knowledge Base


Compiler error when implementing the ISmartTagAction interface or the ISmartTagRecognizer interface in a Visual Basic project

Article ID: 282145

Article Last Modified on 5/24/2007



APPLIES TO

  • Microsoft Office Excel 2007
  • Microsoft Office Excel 2003
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic for Applications 6.0



This article was previously published under Q282145

SYMPTOMS

When you compile a Visual Basic project that uses the ISmartTagAction and ISmartTagRecognizer interfaces, you receive unexpected error messages. This problem occurs when your Visual Basic project includes references to the Microsoft Smart Tags 1.0 Type Library and one or more of the following object libraries:

  • Microsoft Excel 12.0 Object Library
  • Microsoft Excel 11.0 Object Library
  • Microsoft Excel 10.0 Object Library


CAUSE

The Excel object libraries and the Microsoft Smart Tags 1.0 Type Library both include interfaces named ISmartTagAction and ISmartTagRecognizer. If your project references both of these libraries and you implement the interface without fully qualifying the interface name, the compiler attempts to use the first matching interface that it encounters in the project's list of references. If the compiler does not choose the type library you intend to use, a compiler error can occur.

RESOLUTION

To correct this problem, fully qualify the interface name in your Implements statement. To implement ISmartTagRecognizer in the Smart Tags library, use the following:

Implements SmartTagLib.ISmartTagRecognizer
                

Full qualification ensures that the compiler uses a specific type library and does not rely on the order of project references.

REFERENCES

For more information about using the Implements statement, see the following Microsoft Developer Network (MSDN) Web site:

Visual Basic for Applications Reference:
http://msdn2.microsoft.com/en-us/library/aa243384(VS.60).aspx



Additional query words: excel2007 excel2k7 excel12 xl2007 xl2k7 xl12 excel2003 excel2k3 excel11 xl2003 xl2k3 xl11 excel2002 excel2k2 excel10 xl2002 xl2k2 xl10

Keywords: kbexpertiseinter kbcompiler kbpending kbprb KB282145