Hello together
With the following code I open the MSProject 2007 and iterat over the tasks... Everything works perfect but after the MS Update last week I get an error IvalidCastException. . After the Update the System coudn't find the Microsoft Visual Basic for Applications
Extensibility 5.3 (vbide) and stdole2.tlb but both are on the PC. Then I get my last Image back and the error is still ther VBIDE and STDOLE.tlb are back.
When I start my programm on a diffrent PC it still works perfect without any changes.
I work with VisualStudio 2010 / Office 2010 / MSProject 2007 / Windows 7.
private void ReadFromMPP()
{
string mFileName= @"C:\NewMai.mpp";
_projectApp.Visible = true;
// Open Project
Project proj = _projectApp.ActiveProject;
newTask.Start = DateTime.Now;
newTask.Duration = "3";
newTask.ResourceNames = "Rob Caron, Kelly Krout";
lstTasks.Items.Add("NAME / START / ENDE / Text30");
// *************************************************
// Enumerate the tasks
// *************************************************
foreach (Task task in proj.Tasks)
{
if (task != null)
{
string name = task.Name;//
//task.Name = "Direkte Kommunikation";
// Project stores the number of minutes in a workday, so 8 hours per workday * 60 = 480. 480 is a project "day"
int duration_in_days = Int32.Parse(task.Duration.ToString()) / 480;
task.Text30 = "GAGA";
DateTime start = DateTime.Parse(task.Start.ToString()); DateTime finish = DateTime.Parse(task.Finish.ToString());
double percent_complete = Double.Parse(task.PercentComplete.ToString());
string st = task.Text30;
task.Start = "20.07.2010";
// Do something with each task here
// zu einer Liste hinzufügen...
lstTasks.Items.Add(name + " / " + start + " / " + finish + " / " + st);
}
else
{
string name = "Kein Task";
lstTasks.Items.Add(name);
}
}
// Make sure to clean up and close the file
proj = null;
ProgramClose(PjSaveType.pjSave);
}
Can you help me!?
regards
Rudi Otto