timescale in vb.net

M

Michael Parent

hi
I'm using project 2007 professional and visual basic .net 2005
I created an instance of ms project in my vb project via automation, and I
want to get timescale data by daily for all the ressources assigned for each
tasks

in the code below, the "ass" variable represent a ressource assignment on a
task
and I get often the following error when I try to read values (with the
command TSVs.value)
"erreur inattendue avec la méthode" (in french sorry)

System.Runtime.InteropServices.COMException (0x800A03EC): Erreur inattendue
avec la méthode.
à Microsoft.Office.Interop.MSProject.TimeScaleValue.get_Value()
à Suivi_des_taches.modMain.SyncTachesMSProject(String strFile, Int32
intIDProjet, Int32 intIDProjetMSProject)

by the way, I'm able to get some of the data but it fails most of the time

here is my code :

TSV = ass.TimeScaleData(timeStart, timeEnd,
Microsoft.Office.Interop.MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
Microsoft.Office.Interop.MSProject.PjTimescaleUnit.pjTimescaleDays)

For Each TSVs As Microsoft.Office.Interop.MSProject.TimeScaleValue In TSV
Application.DoEvents()
Try

If Not CType(TSVs.Value, String) = "" Then
sngValue = CType(CType(TSVs.Value, Single) / (60), Single)
End If

Catch ex As Exception
intErreur += 1
End Try

Next
 
M

Michael Parent

hey I found an answer to my problem and it is now working fine!!
http://j-integra.intrinsyc.com/support/kb/article.aspx?id=149261&cNode=5M3M7A

'SYMPTOMS

'When accessing Microsoft Office Project Professional 2003
(11.0.2003.0816.15) from a Java client which invokes the getValue() method
of TimeScaleValue object for several times, you may get AutomationException:
0x800a03ec - An unexpected error occurred with the method.

'CAUSE

'This is a bug in Microsoft Project which prevents holding references to a
certain number of TimeScaleValue objects, and you will get the same
0x800a03ec error in C# or VB.NET client when retrieving the Value property
of TimeScaleValue object in a loop which iterates more than 10 times. The
garbage collector of .NET or Java is not clearing up the references fast
enough.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top