Microsoft KB Archive/185885

= PRJ98: Error Accessing BuiltInDocumentProperties or CustomDocumentProperties =

Article ID: 185885

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Project 98 Standard Edition

-



This article was previously published under Q185885



SYMPTOMS
When you attempt to use Automation to programmatically reference either the BuiltInDocumentProperties or CustomDocumentProperties collections in Microsoft Project 98, you may receive one or more of the following errors:

Run-time error 13

Type Mismatch

Run-time error '-2147319779 (8002801d)'

Automation Error

Run-time error '-2147319779 (8002801d)'

Automation Error

"Library not registered"



CAUSE
These errors occur when you attempt to use early binding. Early binding occurs when you declare a variable as an application-defined object type, for example: Dim prjobj as MSProject.Application Microsoft Project 98 does not support accessing either CustomDocumentProperties or BuiltInDocumentProperties using early binding.



RESOLUTION
To work around this problem, use either of the following methods.

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.

Method 1: Use Late Binding
Do not use early binding to reference the Application object; use late binding instead. Late binding occurs when you declare a variable as an object rather than as an application, for example: Dim prjobj as Object Set prjobj = CreateObject("MSProject.Application ")

Method 2: Use a Second Object Variable
Use a second object variable to specifically handle only the BuiltInDocumentProperties and CustomDocumentProperties references. You can set this variable using the GetObject function, for example: Dim prjobj As MSProject.Application 'For early binding Dim prjobj2 As Object               'For late binding

'Create the Project Object. Set prjobj = CreateObject("MSProject.Application")

'Get the second object with GetObject call Set prjobj 2 = GetObject("c:\test.mpp")



STATUS
Microsoft has confirmed this to be a problem in the versions of Microsoft Project listed above.



MORE INFORMATION
For additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

163435 VBA: Programming Resources for Visual Basic for Applications

Additional query words: kbDSupport kbDSD kbInterop kbAutomation

Keywords: kbbug kbdtacode kbpending KB185885

-

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

© Microsoft Corporation. All rights reserved.