16-Bit VB 4.0 and MS Project Objects
I am having a two problems with using Early Binding on MS Project
objects in the 16-bit version of VB 4.0 (Enterprise). When declaring
the application as type "Object" everything works fine.
Ex:
Dim oMSP As Object
...
Set oMSP = CreateObject("MSProject.Application")
After adding a reference to the MSP type library (shipped with MS
Project 4.0) and using the correct type, however, I get a "Cannot
Create OLE object" error that ONLY appears under Windows95. If I run
the app under Windows 3.1, the code below works fine.
Ex:
Dim oMSP As MSProject.Application
...
Set oMSP = CreateObject("MSProject.Application") '' <- Error
The above is a minor annoyance, however. The real problem is that I
can't declare objects as type "Project". I want to do this to improve
performance, since Early Binding is reputed to greatly reduce overhead
and enhance speed (and because the system I'm building handles mutiple
projects which are each over 1Mb in size).
I have tried this, and everything works fine except for the UniqueID
method (not the property). When oProject is declared as type
"Object", the following works fine:
Set RAList = oProject.Tasks.UniqueID(UID).Assignments
Where UID is the Unique task ID of some task, and RAList is an Object
of type "Assignments".
When I dim oProject as type "MSProject.Project", however, I get a
compile-time error telling me that "UniqueID" is not a valid method.
Is there a bug in the type library somewhere? If so, does anyone know
if Microsoft has an updated file for Project 4.0? I have checked
Microsoft.com and come up empty.
Any responses would be greatly appreciated. Please cc me at
articles in such an active group.
Thanks,
-----------------------------
| Erik L. Przekop |
| Damon, Przekop & Associates |
| Dearborn Heights, MI |
| http://www.*-*-*.com/ ~erik |
-----------------------------