none
Return argument has an invalid type RRS feed

  • Question

  • I have an application that uses COM Interop to automate Microsoft Project.  There are a number of folks using the application successfully, but we have one customer who is experiencing a problem that I haven't been able to figure out.  He has Microsoft Office 2010 (32-bit) and Project 2007 (32-bit) installed and anytime our application attempts to communicate with Project, we get the following error:

    Exception: Return argument has an invalid type

    at

    System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType) at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object return Value) at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageDate& msgData) at Microsoft.Office.Interop.MSProject.get_Tasks()

    Any ideas/help would be greatly appreciated.

    Monday, February 6, 2012 1:21 PM

All replies

  • Please provide the code that generates this error and the service pack levels of each Project version. Also show the code that creates the Proejct APplication instance.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management

    Thursday, February 16, 2012 7:26 PM
    Moderator
  • I am also facing same issue. Below is the code.

    Dim mTasks As Microsoft.Office.Interop.MSProject.Tasks

    Dim mTask As Microsoft.Office.Interop.MSProject.Task

    pjApplication.Alerts(False)

    pjApplication.DisplayScheduleMessages = False

    pjApplication.FileOpenEx(sProjectFolder & sPROG_FILE, ReadOnly:=True, DoNotLoadFromEnterprise:=True, XMLName:=System.DBNull.Value)

    mTasks = pjApplication.ActiveProject.Tasks     'This line is giving error - return argument has invalid type.

    Monday, March 11, 2013 1:23 PM