J
Jim Aksel
In Visual Stduio 2005, I have a program that will open MS Project2007 and two
files (Source.mpp & Target.mpp)
I am receiving a COM conversion error-- Unable to cast object of type
System._ComObject to type Microsoft.Office.Interop.MSProject.Task. Here is a
code snippet-
Dim tsk as Microsoft.Office.Interop.MSProject.Task
Dim SourceID as integer
pjApplication.FileOpenEx(SourceFile) 'Sourcefile = "C:\Source.mpp"
SourceID=pjAppllication.ActiveProject.Index 'Integer of mpp file in Window
of Project
For each tsk in pjApplication.Projects.Item(SourceID).Tasks <<<Error is here
'more code here
Next tsk
Using the debugger, tsk appears to have the value Nothing, SourceID is fine
at 1. So it appears I am not assigning tsk properly.
Any guidance to eliminate this error would be helpful. I am referencing
Office12.0 and Project12.0 libraries.
--
If this post was helpful, please consider rating it.
Jim
It''s software; it''s not allowed to win.
Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
files (Source.mpp & Target.mpp)
I am receiving a COM conversion error-- Unable to cast object of type
System._ComObject to type Microsoft.Office.Interop.MSProject.Task. Here is a
code snippet-
Dim tsk as Microsoft.Office.Interop.MSProject.Task
Dim SourceID as integer
pjApplication.FileOpenEx(SourceFile) 'Sourcefile = "C:\Source.mpp"
SourceID=pjAppllication.ActiveProject.Index 'Integer of mpp file in Window
of Project
For each tsk in pjApplication.Projects.Item(SourceID).Tasks <<<Error is here
'more code here
Next tsk
Using the debugger, tsk appears to have the value Nothing, SourceID is fine
at 1. So it appears I am not assigning tsk properly.
Any guidance to eliminate this error would be helpful. I am referencing
Office12.0 and Project12.0 libraries.
--
If this post was helpful, please consider rating it.
Jim
It''s software; it''s not allowed to win.
Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project