Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\mso.dll" rename("RGB", "MSRGB") #import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" raw_interfaces_only, rename("Reference", "ignorethis"), rename("VBE", "testVBE") #import "C:\Program Files\Microsoft Office\OFFICE12\MSPRJ.OLB" auto_search exclude("IFont", "IPicture") rename("RGB", "ignorethis"), rename("DialogBox", "ignorethis"), rename("VBE", "testVBE"), rename("ReplaceText", "EReplaceText"), rename("CopyFile","ECopyFile"), rename("FindText", "EFindText"), rename("NoPrompt", "ENoPrompt") //Here is the code to automate Project: MSProject::_MSProjectPtr app(__uuidof(MSProject::Application)); //project opens when this line is called if it wasn't open already MSProject::_IProjectDocPtr project; MSProject::TasksPtr tasks; MSProject::TaskPtr task; app->PutVisible(-1); //prj is already visible, but if I set this to 0, it hides, it so I am successfully talking to prj project = app->GetActiveProject(); //project is nonzero after this call long x = project->GetNumberOfTasks(); //this returns 3 which is correct!! tasks = project->GetTasks(); //tasks is nonzero after this call x = tasks->Count; //exception is thrown here. I have also tried tasks->GetCount() and tasks->get_Count(&x) All of which result in the same error //Also, this produces an error as well: //task = tasks->GetItem(0); //Error: Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.