Microsoft KB Archive/825937

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

Article ID: 825937

Article Last Modified on 5/16/2007

-

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

-



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  Set X = Application.COMAddins.Item().Object

'State is a public property of the COM Addin specified by  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()

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

End Sub Sub MyProperty

Dim X as Object 'Create a new object using the  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 &quot;Applies to&quot; section.

Keywords: kbaddin kbvba kbmacroexample kbcode KB825937

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.