A
Activate()
Hi,
I am implmenting a custom .NET application with MSProject 2003 integration.
The integration is fine and the .NET app is also working fine. Now i am
stuck on the 'last lap'.
The application opens many .MPP files and updates them randomly (some are
modified and some are not). Now at the end of processing, i am having a
problem. I need to FileSave() only the modified ones. I know which ones.
Since only Application.ActiveProject can be FileSave(), as per MSDN
MSProject automation reference, we need to first activate 'The' project.
Refer my code below:
oMSProjectApp = CreateObject("MSProject.Application")
oMSProjectApp.FileOpen("c:\Project1.mpp") 'After this, Project1 is the
ActiveProject
oMSProjectApp.FileOpen("c:\Project2.mpp") 'After this, Project2 is the
ActiveProject
'I modify Project1..Now i need to save it..
oMSProjectApp.Projects(1).Activate()
This is throwing up an exception:
A first chance exception of type
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Run-time exception thrown : System.Runtime.InteropServices.COMException - An
unexpected error occurred with the method.
What is going wrong?!
Thanks in advance!
I am implmenting a custom .NET application with MSProject 2003 integration.
The integration is fine and the .NET app is also working fine. Now i am
stuck on the 'last lap'.
The application opens many .MPP files and updates them randomly (some are
modified and some are not). Now at the end of processing, i am having a
problem. I need to FileSave() only the modified ones. I know which ones.
Since only Application.ActiveProject can be FileSave(), as per MSDN
MSProject automation reference, we need to first activate 'The' project.
Refer my code below:
oMSProjectApp = CreateObject("MSProject.Application")
oMSProjectApp.FileOpen("c:\Project1.mpp") 'After this, Project1 is the
ActiveProject
oMSProjectApp.FileOpen("c:\Project2.mpp") 'After this, Project2 is the
ActiveProject
'I modify Project1..Now i need to save it..
oMSProjectApp.Projects(1).Activate()
This is throwing up an exception:
A first chance exception of type
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Run-time exception thrown : System.Runtime.InteropServices.COMException - An
unexpected error occurred with the method.
What is going wrong?!
Thanks in advance!