Help and Support

Article ID: 825937 - Last Review: May 16, 2007 - Revision: 4.1

Cannot return the public property of a COM add-in in Office 2003

Expand all | Collapse all

SYMPTOMS

When you try to return a public property of a COM Add-in in a Microsoft Office program, the property is not returned.

For example, this problem is illustrated in the following Visual Basic for Applications (VBA) macro code:
Sub MyProperty()

   Dim X as Object
   'Reference the COM object for the COM Addin specified by <progID>
   Set X = Application.COMAddins.Item(<progID>).Object

   'State is a public property of the COM Addin specified by <progID>
   Debug.Print X.State

End Sub

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To return the public properties of a COM add-in, use one of the following code examples.
Sub MyProperty()

   Dim X as Object

   Set X = CreateObject(<progID>)

   'State is a public property of the COM Addin specified by <progID>
   Debug.Print X.State

End Sub
Sub MyProperty()

   Dim X as Object
   'Create a new object using the <progID> of the COM Addin object at 
   'Index 1 in the collection.
   Set X = CreateObject(Application.COMAddins(1).ProgId) 

   'State is a public property of the COM Addin specified in the previous line.
   Debug.Print X.State

End Sub

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

APPLIES TO
  • Microsoft Office Standard Edition 2003
  • Microsoft Office Basic 2007
  • Microsoft Office Home and Student 2007
  • Microsoft Office Professional 2007
  • Microsoft Office Professional Plus 2007
  • Microsoft Office Small Business 2007
  • Microsoft Office Standard 2007
  • Microsoft Office Ultimate 2007
Keywords: 
kbaddin kbvba kbmacroexample kbcode KB825937

Article Translations

 

Related Support Centers